public function testCanThrowExceptionAtUnknownTypes() { $this->setExpectedException('InvalidArgumentException'); $file = fopen('../.travis.yml', 'w+'); $dispatch = Dispatch::toClass($file); }
/** * 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; }
/** * 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); }