コード例 #1
0
ファイル: Request.php プロジェクト: freyr/envelope
 public function get($field, $default = null)
 {
     if (!$this->get->has($field)) {
         if (!$this->post->has($field)) {
             if (!$this->cookie->has($field)) {
                 if ($default === null) {
                     throw new RequestParameterNotFoundException();
                 }
                 return $default;
             } else {
                 return $this->cookie->get($field);
             }
         } else {
             return $this->post->get($field);
         }
     } else {
         return $this->get->get($field);
     }
 }
コード例 #2
0
ファイル: NestedBag.php プロジェクト: bolt/collections
 public function has($path)
 {
     $parts = explode('/', $path);
     if (count($parts) <= 1) {
         return parent::has($path);
     }
     $value = $this;
     while (null !== ($part = array_shift($parts))) {
         if (!Utils::isArrayAccessible($value) || !isset($value[$part])) {
             return false;
         }
         $value = $value[$part];
     }
     return true;
 }