protected function addDataProvider(DataProvider $dataProvider) { $this->dataProviders[ClassName::fromString(get_class($dataProvider))->shortName()->string()] = $dataProvider; return $this; }
protected static function configuration() { return new \Eloquent\Typhoon\Configuration\RuntimeConfiguration(\Eloquent\Cosmos\ClassName::fromString('\\Typhoon'), false); }
/** * @param ReflectionParameter $reflector * * @return Parameter */ public function parseParameterReflector(ReflectionParameter $reflector) { $this->typeCheck->parseParameterReflector(func_get_args()); if ($class = $reflector->getClass()) { $type = new ObjectType(ClassName::fromString($class->getName())->toAbsolute()); } elseif ($reflector->isArray()) { $type = new TraversableType(new ArrayType(), new MixedType(), new MixedType()); } else { $reflectorReflector = new ReflectionObject($reflector); if ($reflectorReflector->hasMethod('isCallable') && $reflector->isCallable()) { $type = new CallableType(); } else { $type = new MixedType(); } } if (!$type instanceof MixedType && $reflector->allowsNull()) { $type = new OrType(array($type, new NullType())); } return new Parameter($reflector->getName(), $type, null, $reflector->isOptional(), $reflector->isPassedByReference()); }
/** * @param mixed $data * * @return Configuration */ protected function buildConfiguration($data) { $this->typeCheck->buildConfiguration(func_get_args()); $this->validateData($data); $configuration = new Configuration($data->{'output-path'}, $data->{'source-paths'}); if (property_exists($data, ConfigurationOption::LOADER_PATHS()->value())) { $configuration->setLoaderPaths($data->{'loader-paths'}); } if (property_exists($data, ConfigurationOption::VALIDATOR_NAMESPACE()->value())) { $configuration->setValidatorNamespace(ClassName::fromString($data->{'validator-namespace'})); } if (property_exists($data, ConfigurationOption::USE_NATIVE_CALLABLE()->value())) { $configuration->setUseNativeCallable($data->{'use-native-callable'}); } return $configuration; }
/** * @param RuntimeConfiguration $configuration * @param ReflectionClass $class * @param null &$className * * @return string */ public function generateFromClass(RuntimeConfiguration $configuration, ReflectionClass $class, &$className = null) { $this->typeCheck->generateFromClass(func_get_args()); return $this->generateFromFile($configuration, ClassName::fromString($class->getName())->toAbsolute(), $class->getFileName(), $className); }