本文整理汇总了PHP中Method::from方法的典型用法代码示例。如果您正苦于以下问题:PHP Method::from方法的具体用法?PHP Method::from怎么用?PHP Method::from使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Method
的用法示例。
在下文中一共展示了Method::from方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConstructor
/**
* @return Method|NULL
*/
public function getConstructor()
{
return ($ref = parent::getConstructor()) ? Method::from($this->getName(), $ref->getName()) : NULL;
}
示例2: generateClassBaseCase
/**
* Generates SK ITCBundle Command Code Generator PHPUnit Abstract Generator Generator Class Base Case
*
* @param InputInterface $input
* @param OutputInterface $output
*/
public function generateClassBaseCase(InputInterface $input, OutputInterface $output)
{
$cases = $this->getTestConfig()->getTestsCase();
$this->writeNotice("Generating Class Tests Base Case: " . count($cases));
foreach ($cases as $configName => $configClass) {
print $configName . "\n";
}
return;
foreach ($configCase as $configName => $configClass) {
$classService = Arrays::get($configServices, $configName);
$classType = Arrays::get($classService, 'class');
$classReflection = ReflectionClassType::from($classType);
$classGenerator = PhpGeneratorClassType::from($classType);
$classAnnotations = $classReflection->getAnnotations();
$classAnnotationsSwitch = Arrays::get($classAnnotations, 'no-test', FALSE);
if (FALSE !== $classAnnotationsSwitch) {
continue;
}
$className = $classGenerator->getName() . "Base";
if ('interface' == $classGenerator->getType() || $classGenerator->isAbstract()) {
continue;
}
$classParent = "BaseCase";
$dependencies = array('\\ITC\\Tests\\BaseCase' => 'BaseCase');
$classGenerator->setName($className);
$classGenerator->setExtends($classParent);
$classGenerator->setImplements(array());
$classGenerator->setProperties(array());
$classGenerator->setMethods(array());
$classGenerator->setConsts(array());
$classNameProperty = $classGenerator->addProperty("className", $configName);
$classNameProperty->setVisibility('protected');
// $classGenerator->addDocument("@runInSeparateProcess");
$classProviderData = array();
foreach ($configClass as $configClassMethod => $paramametersConfig) {
$methodReflection = $classReflection->getMethod($configClassMethod);
$methodGenerator = Method::from($methodReflection);
$methodAnnotations = $methodReflection->getAnnotations();
$methodAnnotationsReturn = Arrays::get($methodAnnotations, 'return', NULL);
$methodAnnotationsSwitch = Arrays::get($methodAnnotations, 'no-test', FALSE);
if (FALSE !== $methodAnnotationsSwitch) {
continue;
}
if ($methodReflection->isAbstract()) {
continue;
}
if ('__construct' == $methodReflection->getName()) {
continue;
}
if (!is_callable(array($classReflection->getName(), $methodReflection->getName()))) {
continue;
}
$providerName = $methodReflection->getName() . "Provider";
$provider = $classGenerator->addMethod($providerName);
$permutationOffset = array();
$parametersPermutations = new Permutation($paramametersConfig);
foreach ($parametersPermutations as $permutation) {
$permutationOffset[] = $permutation;
}
$classProviderData[$methodReflection->getName()] = $permutationOffset;
$provider->setBody(sprintf('return $this->getProviderData("%s");', $methodReflection->getName()));
}
$providerData = $classGenerator->addProperty("providerData", $classProviderData);
$providerData->setVisibility('protected');
$classInfo = new \SplFileInfo(dirname(str_replace($this->getRootDir(), $this->getDest(), $classReflection->getFileName())) . DIRECTORY_SEPARATOR . $classGenerator->getName() . ".php");
$classDependency = "";
foreach ($dependencies as $dependency => $dependencyClass) {
$classDependency .= "\nuse " . $dependency;
if ('' == $dependencyClass) {
$classDependency .= " as " . $dependencyClass;
}
$classDependency .= ";";
}
$classCode = sprintf("<?php\nnamespace %s;\n%s\n%s", $classReflection->getNamespaceName(), $classDependency, $classGenerator);
$this->saveClass($classCode, $classInfo);
}
}