/** * Convert a value to camel case. * * @param string $value * @return string */ function camel($value) { return lcfirst(studly($value)); }
/** * 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."); }
/** * 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)); }
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; }