Exemplo n.º 1
0
 /**
  * Get autoload path for a class.
  *
  * @param  string|object  $class
  * @return string
  */
 public function pathForClass($class)
 {
     $path = Reflect::getDirectory($class);
     return rtrim($path, '/') . '/';
 }
Exemplo n.º 2
0
 /**
  * Gives this class the ability to set and get any of the
  * properties of the instances that inherit from this class
  * using shorthand notation. Call label() instead of
  * setLabel() for example.
  *
  * Also it allows you to specify validations in the same dynamic
  * manner like required() or between(1, 10).
  *
  * @param string  $method
  * @param array  $parameters
  * @return mixed
  */
 public function __call($method, $parameters)
 {
     if (!method_exists($this, $method)) {
         $method = Str::studly($method);
         $name = 'set' . $method;
         if (method_exists($this, $name)) {
             return call_user_func_array([$this, $name], $parameters);
         }
         $name = 'validate' . $method;
         if (method_exists($this, $name)) {
             $arguments = Reflect::getParameters($this, $name);
             $parameters = array_pad($parameters, count($arguments), null);
             $this->validations[$name] = array_combine($arguments, $parameters);
             return $this;
         }
     }
 }
Exemplo n.º 3
0
 /**
  * Set the plugin autoload path.
  *
  * @return void
  */
 public function setPath()
 {
     $this->path = Reflect::getDirectory($this);
 }