本文整理汇总了PHP中Nette\PhpGenerator\ClassType::setAbstract方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassType::setAbstract方法的具体用法?PHP ClassType::setAbstract怎么用?PHP ClassType::setAbstract使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\PhpGenerator\ClassType
的用法示例。
在下文中一共展示了ClassType::setAbstract方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateClassType
//.........这里部分代码省略.........
$comment = $typesDescription[$fieldClassName];
}
}
if (!$config->isInterface) {
/** $field @var \Nette\PhpGenerator\Property */
$field = $this->currentClass->addProperty($name);
$field->setStatic($isStatic);
if ($config->isEnum) {
$field->setVisibility('protected');
} else {
$field->setVisibility('private');
}
$field->addComment($comment)->addComment('@var ' . $fieldClassFull);
}
$createSetter = $config->haveSetter;
if (array_key_exists('setter', $fieldProperties)) {
$createSetter = $fieldProperties['setter'];
}
$createGetter = $config->haveGetter;
if (array_key_exists('getter', $fieldProperties)) {
$createGetter = $fieldProperties['getter'];
}
if ($config->isInterface) {
if ($createGetter) {
$this->addGetter($name, $fieldClassFull, $isStatic, false);
}
if ($createSetter) {
$this->addSetter($name, $fieldClassFull, $isStatic, false);
}
} else {
if ($createGetter) {
$this->addGetter($name, $fieldClassFull, $isStatic, true);
}
if ($createSetter) {
$this->addSetter($name, $fieldClassFull, $isStatic, true);
}
}
if (!$isAutoinizialize) {
$first = false;
}
}
if ($config->haveConstructor) {
$methodConstructor->setBody($body, []);
}
}
//end fields
if (array_key_exists('methods', $properties)) {
$body = '';
foreach ($properties['methods'] as $methodName => $methodsProperties) {
$this->info('Aggiungo method', ['class' => $this->currentClass->getName(), 'methodName' => $methodName, 'methodProp' => $methodsProperties]);
/** $newMethodCall @var \Nette\PhpGenerator\Method */
$newMethodCall = $this->currentClass->addMethod($methodName);
$newMethodCall->setFinal(true);
$newMethodCall->setStatic(false);
if (array_key_exists('static', $methodsProperties)) {
$newMethodCall->setStatic($methodsProperties['static']);
}
if (array_key_exists('description', $methodsProperties)) {
$newMethodCall->setVisibility($methodsProperties['visibility']);
} else {
$newMethodCall->setVisibility('public');
}
if (array_key_exists('description', $methodsProperties)) {
$newMethodCall->addComment($methodsProperties['description']);
} else {
$returnType = 'void';
if (array_key_exists('@return', $methodsProperties)) {
$returnType = $methodsProperties['@return'];
//TODO: .'|null' va messo in quale condizione?
$newMethodCall->addComment('@return ' . $returnType);
} else {
//NOPE
}
}
if (array_key_exists('params', $methodsProperties)) {
foreach ($methodsProperties['params'] as $paramName => $paramProp) {
if (array_key_exists('class', $paramProp)) {
$newMethodCall->addParameter($paramName)->setTypeHint($paramProp['class']);
}
if (array_key_exists('primitive', $paramProp)) {
$newMethodCall->addParameter($paramName);
}
}
}
$body = ' // FIMXE: da implementare ';
if (array_key_exists('body', $methodsProperties)) {
$body = $methodsProperties['body'];
}
$newMethodCall->setBody($body);
}
}
if ($config->isEnum) {
$this->currentClass->setAbstract(true);
$this->addSingleton('Singleton instance for enum', false);
$this->addParseString();
}
if ($config->isSingleton) {
$this->addSingleton('Singleton instance', true);
}
}