示例#1
0
 /**
  * Convert a value to camel case.
  *
  * @param  string $value
  * @return string
  */
 function camel($value)
 {
     return lcfirst(studly($value));
 }
示例#2
0
 /**
  * Provides dynamic calls.
  *
  * @param $name
  * @param array $arguments
  * @throws \PragmaRX\ZipCode\Exceptions\PropertyDoesNotExists
  * @return mixed
  */
 public function __call($name, array $arguments)
 {
     if (substr($name, 0, 3) == 'get') {
         $property = substr($name, 3);
         $possibleNames = [$property, snake($property), studly($property), camel($property)];
         foreach ($possibleNames as $name) {
             if (isset($this->publicProperties[$name])) {
                 return $this->publicProperties[$name];
             }
         }
     }
     throw new PropertyDoesNotExists("Property '{$name}' does not exists in Result object.");
 }
示例#3
0
 /**
  * Convert a value to camel case.
  *
  * @param  string  $value
  * @return string
  */
 function camel_case($value)
 {
     $camelCache = [];
     if (isset($camelCache[$value])) {
         return $camelCache[$value];
     }
     return $camelCache[$value] = lcfirst(studly($value));
 }
示例#4
0
 private function validate($attribute, $rule, $parameters = null)
 {
     $rule = studly($rule);
     $method = "validate{$rule}";
     $value = $this->getValue($attribute);
     if (!self::$_validate->{$method}($attribute, $value, $parameters)) {
         self::$_message->addFailure($attribute, $rule, $parameters, self::$_instance);
         return false;
     }
     return true;
 }