Ejemplo n.º 1
0
 public function testCanThrowExceptionAtUnknownTypes()
 {
     $this->setExpectedException('InvalidArgumentException');
     $file = fopen('../.travis.yml', 'w+');
     $dispatch = Dispatch::toClass($file);
 }
Ejemplo n.º 2
0
 /**
  * Tries to find the right class to call
  *
  * @param string $callingClass The original class
  * @param string $method       The method
  * @param array  $arguments    The arguments
  *
  * @return string The correct class
  */
 protected static function computeClassToCall($callingClass, $method, $arguments)
 {
     if (!StringMethods::find($callingClass, 'Underscore\\Types')) {
         if (isset($arguments[0])) {
             $callingClass = Dispatch::toClass($arguments[0]);
         } else {
             $callingClass = Method::findInClasses($callingClass, $method);
         }
     }
     return $callingClass;
 }
Ejemplo n.º 3
0
 /**
  * Dispatch to the correct Repository class
  *
  * @param  mixed $subject The subject
  *
  * @return Repository
  */
 public static function from($subject)
 {
     $class = Dispatch::toClass($subject);
     return $class::from($subject);
 }