本文整理汇总了PHP中PhpParser\Node::isPublic方法的典型用法代码示例。如果您正苦于以下问题:PHP Node::isPublic方法的具体用法?PHP Node::isPublic怎么用?PHP Node::isPublic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpParser\Node
的用法示例。
在下文中一共展示了Node::isPublic方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: enterNode
function enterNode(\PhpParser\Node $node)
{
if ($node instanceof \PhpParser\Node\Stmt\Namespace_) {
$this->addNamespace(array('namespace' => $node->name->toString(), 'line' => $node->getLine(), 'file' => $this->file));
}
if ($node instanceof \PhpParser\Node\Stmt\Use_) {
foreach ($node->uses as $use) {
$this->addUse(array('name' => $use->name, 'alias' => $use->alias));
}
}
if ($node instanceof \PhpParser\Node\Stmt\Class_) {
$this->addClass(array('name' => $node->name, 'extends' => $node->extends, 'implements' => $node->implements, 'abstract' => $node->isAbstract(), 'final' => $node->isFinal(), 'comment' => $node->getDocComment(), 'doc' => $this->doc_comment_parser->parse($node->getDocComment()), 'line' => $node->getLine(), 'file' => $this->file));
}
if ($node instanceof \PhpParser\Node\Stmt\Interface_) {
$this->addInterface(array('name' => $node->name, 'extends' => $node->extends, 'comment' => $node->getDocComment(), 'doc' => $this->doc_comment_parser->parse($node->getDocComment()), 'line' => $node->getLine(), 'file' => $this->file));
}
if ($node instanceof \PhpParser\Node\Stmt\ClassMethod) {
$this->addClassMethod(array('byRef' => $node->byRef, 'name' => $node->name, 'params' => $node->params, 'returnType' => $node->returnType, 'public' => $node->isPublic(), 'protected' => $node->isProtected(), 'private' => $node->isPrivate(), 'abstract' => $node->isAbstract(), 'final' => $node->isFinal(), 'static' => $node->isStatic(), 'comment' => $node->getDocComment(), 'doc' => $this->doc_comment_parser->parse($node->getDocComment()), 'line' => $node->getLine(), 'file' => $this->file));
}
if ($node instanceof \PhpParser\Node\Stmt\Property) {
$this->last_property = $node;
}
if ($node instanceof \PhpParser\Node\Stmt\PropertyProperty) {
$this->addClassProperty(array('name' => $node->name, 'default' => $node->default, 'public' => $this->last_property->isPublic(), 'protected' => $this->last_property->isProtected(), 'private' => $this->last_property->isPrivate(), 'static' => $this->last_property->isStatic(), 'comment' => $node->getDocComment(), 'doc' => $this->doc_comment_parser->parse($node->getDocComment()), 'line' => $node->getLine(), 'file' => $this->file));
}
// $this->logger->info(get_class($node));
}
示例2: enter
public final function enter(Node $node)
{
if ($node->getType() == 'Stmt_ClassMethod' && $node->isPublic()) {
$fqcn = $this->getCurrentFqcn();
$this->enterPublicMethod($fqcn, $node);
}
}
示例3: enter
protected function enter(Node $node)
{
if ($node instanceof Property) {
if ($node->isPublic()) {
foreach ($node->props as $property) {
$this->dispatch(new \Solidifier\Defects\PublicAttribute($this->currentObjectType, $property->name, $node));
}
}
}
}
示例4: enter
public function enter(Node $node)
{
switch ($node->getType()) {
case 'Stmt_ClassMethod':
if ($node->isPublic()) {
$fqcn = $this->getCurrentFqcn();
$this->getReflectionContext()->addMethodToClass($fqcn, $node->name);
}
break;
}
}
示例5: enter
public function enter(Node $node)
{
switch ($node->getType()) {
case 'Stmt_ClassMethod':
if ($node->isPublic()) {
$this->context->pushState('trait-method', $node);
$this->enterPublicMethod($node);
}
break;
case 'Stmt_TraitUse':
$fqcn = $this->getCurrentFqcn();
$currentVertex = $this->findVertex('trait', $fqcn);
$this->enterTraitUse($node, $currentVertex);
break;
}
}
示例6: extractMethod
/**
* Ищвлекает тело метода из текущего узла
*
* @param Node|ClassMethod $stmt Узел
* @param Method[] $methods Список методов
*
* @return void
*/
private function extractMethod($stmt, array &$methods)
{
if (!$stmt instanceof ClassMethod) {
return;
}
$skip = $this->isPublicOnly && $stmt->isPublic() === false;
if (!$skip) {
$methods[] = new Method(new MethodContext($this->context->namespace, $this->context->class), $stmt->name, $this->printer->prettyPrint([$stmt]));
}
}
示例7: detectNewMagicDefinitions
/**
* @param \PhpParser\Node $node
*/
private function detectNewMagicDefinitions(Node $node)
{
if ($node instanceof Node\Stmt\ClassMethod && $node->isPublic() || ($node instanceof Node\Expr\MethodCall || $node instanceof Node\Expr\StaticCall) && is_string($node->name)) {
if (strcasecmp($node->name, '__callStatic') === 0) {
$this->getResult()->addRequirement(Reason::CALLSTATIC_MAGIC_METHOD, $node->getLine());
} elseif (strcasecmp($node->name, '__invoke') === 0) {
$this->getResult()->addRequirement(Reason::INVOKE_MAGIC_METHOD, $node->getLine());
}
} elseif ($node instanceof Node\Scalar\MagicConst\Dir) {
$this->getResult()->addRequirement(Reason::DIR_MAGIC_CONSTANT, $node->getLine());
}
}