コード例 #1
0
ファイル: ParameterBag.php プロジェクト: pinepain/ape
 /**
  * Returns true if the parameter is defined.
  *
  * @param string $key The key
  *
  * @return Boolean true if the parameter exists, false otherwise
  */
 public static function has($key)
 {
     return \Ape\ParameterBag::has($key);
 }
コード例 #2
0
ファイル: Rules.php プロジェクト: pinepain/ape
 /**
  * Get the size of an attribute.
  *
  * @param $attribute
  * @param $value
  * @param $parameters
  * @param $source
  * @param $rules
  *
  * @return mixed
  */
 protected function getSize($attribute, $value, $parameters, $source, ParameterBag $rules)
 {
     $is_numeric = $rules->has($this->rules_numeric);
     if ($is_numeric) {
         //
         return $value;
         // If it is a number, then number itself is the size
     } elseif (is_array($value)) {
         return count($value);
         // If it is an array, then elements number is the size
     }
     // For the rest entire length of the string will be considered the attribute size.
     return $this->getStringSize($value);
 }