Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 88
Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 215
Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 216
Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 217
Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 218
Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 219
Warning: Cannot modify header information - headers already sent by (output started at /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php:88) in /home/afelisqd/cppseducation.sc.tz/admin/images/photos/17587263121019776732_admin-dbb.php on line 220
PK ! 6+ TagTest.phpnu Iw selfClosing();
$this->assertTrue($tag->isSelfClosing());
}
public function testSetAttributes()
{
$attr = [
'href' => [
'value' => 'http://google.com',
'doublequote' => false,
],
];
$tag = new Tag('a');
$tag->setAttributes($attr);
$this->assertEquals('http://google.com', $tag->getAttribute('href')['value']);
}
public function testRemoveAttribute()
{
$tag = new Tag('a');
$tag->setAttribute('href', 'http://google.com');
$tag->removeAttribute('href');
$this->assertNull($tag->getAttribute('href')['value']);
}
public function testRemoveAllAttributes()
{
$attr = [
'class' => [
'value' => 'clear-fix',
'doubleQuote' => true,
],
];
$tag = new Tag('a');
$tag->setAttribute('href', 'http://google.com');
$tag->setAttribute('class', $attr);
$tag->removeAllAttributes();
$this->assertEquals(0, count($tag->getAttributes()));
}
public function testSetAttributeNoArray()
{
$tag = new Tag('a');
$tag->setAttribute('href', 'http://google.com');
$this->assertEquals('http://google.com', $tag->getAttribute('href')['value']);
}
public function testSetAttributesNoDoubleArray()
{
$attr = [
'href' => 'http://google.com',
'class' => 'funtimes',
];
$tag = new Tag('a');
$tag->setAttributes($attr);
$this->assertEquals('funtimes', $tag->class['value']);
}
public function testNoise()
{
$tag = new Tag('a');
$this->assertTrue($tag->noise('noise') instanceof Tag);
}
public function testGetAttributeMagic()
{
$attr = [
'href' => [
'value' => 'http://google.com',
'doublequote' => false,
],
];
$tag = new Tag('a');
$tag->setAttributes($attr);
$this->assertEquals('http://google.com', $tag->href['value']);
}
public function testSetAttributeMagic()
{
$tag = new Tag('a');
$tag->href = 'http://google.com';
$this->assertEquals('http://google.com', $tag->href['value']);
}
public function testMakeOpeningTag()
{
$attr = [
'href' => [
'value' => 'http://google.com',
'doubleQuote' => true,
],
];
$tag = new Tag('a');
$tag->setAttributes($attr);
$this->assertEquals('', $tag->makeOpeningTag());
}
public function testMakeOpeningTagEmptyAttr()
{
$attr = [
'href' => [
'value' => 'http://google.com',
'doubleQuote' => true,
],
];
$tag = new Tag('a');
$tag->setAttributes($attr);
$tag->selected = [
'value' => null,
];
$this->assertEquals('', $tag->makeOpeningTag());
}
public function testMakeOpeningTagSelfClosing()
{
$attr = [
'class' => [
'value' => 'clear-fix',
'doubleQuote' => true,
],
];
$tag = new Tag('div');
$tag->selfClosing()
->setAttributes($attr);
$this->assertEquals('', $tag->makeOpeningTag());
}
public function testMakeClosingTag()
{
$tag = new Tag('a');
$this->assertEquals('', $tag->makeClosingTag());
}
public function testMakeClosingTagSelfClosing()
{
$tag = new Tag('div');
$tag->selfClosing();
$this->assertEmpty($tag->makeClosingTag());
}
}
PK ! 9g g ParentTest.phpnu Iw addChild($child);
$this->assertTrue($parent->hasChildren());
}
public function testHasChildNoChildren()
{
$node = new Node;
$this->assertFalse($node->hasChildren());
}
public function testAddChild()
{
$parent = new Node;
$child = new Node;
$this->assertTrue($parent->addChild($child));
}
public function testAddChildTwoParent()
{
$parent = new Node;
$parent2 = new Node;
$child = new Node;
$parent->addChild($child);
$parent2->addChild($child);
$this->assertFalse($parent->hasChildren());
}
public function testGetChild()
{
$parent = new Node;
$child = new Node;
$child2 = new Node;
$parent->addChild($child);
$parent->addChild($child2);
$this->assertTrue($parent->getChild($child2->id()) instanceof Node);
}
public function testRemoveChild()
{
$parent = new Node;
$child = new Node;
$parent->addChild($child);
$parent->removeChild($child->id());
$this->assertFalse($parent->hasChildren());
}
public function testRemoveChildNotExists()
{
$parent = new Node;
$parent->removeChild(1);
$this->assertFalse($parent->hasChildren());
}
public function testNextChild()
{
$parent = new Node;
$child = new Node;
$child2 = new Node;
$parent->addChild($child);
$parent->addChild($child2);
$this->assertEquals($child2->id(), $parent->nextChild($child->id())->id());
}
public function testNextChildWithRemove()
{
$parent = new Node;
$child = new Node;
$child2 = new Node;
$child3 = new Node;
$parent->addChild($child);
$parent->addChild($child2);
$parent->addChild($child3);
$parent->removeChild($child2->id());
$this->assertEquals($child3->id(), $parent->nextChild($child->id())->id());
}
public function testPreviousChild()
{
$parent = new Node;
$child = new Node;
$child2 = new Node;
$parent->addChild($child);
$parent->addChild($child2);
$this->assertEquals($child->id(), $parent->previousChild($child2->id())->id());
}
public function testPreviousChildWithRemove()
{
$parent = new Node;
$child = new Node;
$child2 = new Node;
$child3 = new Node;
$parent->addChild($child);
$parent->addChild($child2);
$parent->addChild($child3);
$parent->removeChild($child2->id());
$this->assertEquals($child->id(), $parent->previousChild($child3->id())->id());
}
public function testFirstChild()
{
$parent = new Node;
$child = new Node;
$child2 = new Node;
$child3 = new Node;
$parent->addChild($child);
$parent->addChild($child2);
$parent->addChild($child3);
$this->assertEquals($child->id(), $parent->firstChild()->id());
}
public function testLastChild()
{
$parent = new Node;
$child = new Node;
$child2 = new Node;
$child3 = new Node;
$parent->addChild($child);
$parent->addChild($child2);
$parent->addChild($child3);
$this->assertEquals($child3->id(), $parent->lastChild()->id());
}
public function testReplaceChild()
{
$parent = new Node;
$child = new Node;
$child2 = new Node;
$child3 = new Node;
$parent->addChild($child);
$parent->addChild($child2);
$parent->replaceChild($child->id(), $child3);
$this->assertFalse($parent->isChild($child->id()));
}
/**
* @expectedException PHPHtmlParser\Exceptions\CircularException
*/
public function testSetParentDescendantException()
{
$parent = new Node;
$child = new Node;
$parent->addChild($child);
$parent->setParent($child);
}
/**
* @expectedException PHPHtmlParser\Exceptions\CircularException
*/
public function testAddChildAncestorException()
{
$parent = new Node;
$child = new Node;
$parent->addChild($child);
$child->addChild($parent);
}
/**
* @expectedException PHPHtmlParser\Exceptions\CircularException
*/
public function testAddItselfAsChild()
{
$parent = new Node;
$parent->addChild($parent);
}
public function testIsAncestorParent()
{
$parent = new Node;
$child = new Node;
$parent->addChild($child);
$this->assertTrue($child->isAncestor($parent->id()));
}
public function testGetAncestor()
{
$parent = new Node;
$child = new Node;
$parent->addChild($child);
$ancestor = $child->getAncestor($parent->id());
$this->assertEquals($parent->id(), $ancestor->id());
}
public function testGetGreatAncestor()
{
$parent = new Node;
$child = new Node;
$child2 = new Node;
$parent->addChild($child);
$child->addChild($child2);
$ancestor = $child2->getAncestor($parent->id());
$this->assertEquals($parent->id(), $ancestor->id());
}
public function testGetAncestorNotFound()
{
$parent = new Node;
$ancestor = $parent->getAncestor(1);
$this->assertNull($ancestor);
}
}
PK ! g2 2 HtmlTest.phpnu Iw setAttributes([
'class' => [
'value' => 'all',
'doubleQuote' => true,
],
]);
$a = new Tag('a');
$a->setAttributes([
'href' => [
'value' => 'http://google.com',
'doubleQuote' => false,
],
]);
$br = new Tag('br');
$br->selfClosing();
$parent = new HtmlNode($div);
$childa = new HtmlNode($a);
$childbr = new HtmlNode($br);
$parent->addChild($childa);
$parent->addChild($childbr);
$childa->addChild(new TextNode('link'));
$this->assertEquals("link
", $parent->innerHtml());
}
public function testInnerHtmlTwice()
{
$div = new Tag('div');
$div->setAttributes([
'class' => [
'value' => 'all',
'doubleQuote' => true,
],
]);
$a = new Tag('a');
$br = new Tag('br');
$br->selfClosing();
$parent = new HtmlNode($div);
$childa = new HtmlNode($a);
$childa->setAttribute('href', [
'value' => 'http://google.com',
'doubleQuote' => false,
]);
$childbr = new HtmlNode($br);
$parent->addChild($childa);
$parent->addChild($childbr);
$childa->addChild(new TextNode('link'));
$inner = $parent->innerHtml();
$this->assertEquals($inner, $parent->innerHtml());
}
/**
* @expectedException PHPHtmlParser\Exceptions\UnknownChildTypeException
*/
public function testInnerHtmlUnkownChild()
{
$div = new Tag('div');
$div->setAttributes([
'class' => [
'value' => 'all',
'doubleQuote' => true,
],
]);
$a = new Tag('a');
$a->setAttributes([
'href' => [
'value' => 'http://google.com',
'doubleQuote' => false,
],
]);
$br = new Tag('br');
$br->selfClosing();
$parent = new HtmlNode($div);
$childa = new HtmlNode($a);
$childbr = new MockNode($br);
$parent->addChild($childa);
$parent->addChild($childbr);
$childa->addChild(new TextNode('link'));
$inner = $parent->innerHtml();
$this->assertEquals($inner, $parent->innerHtml());
}
public function testInnerHtmlMagic()
{
$parent = new HtmlNode('div');
$parent->tag->setAttributes([
'class' => [
'value' => 'all',
'doubleQuote' => true,
],
]);
$childa = new HtmlNode('a');
$childa->getTag()->setAttributes([
'href' => [
'value' => 'http://google.com',
'doubleQuote' => false,
],
]);
$childbr = new HtmlNode('br');
$childbr->getTag()->selfClosing();
$parent->addChild($childa);
$parent->addChild($childbr);
$childa->addChild(new TextNode('link'));
$this->assertEquals("link
", $parent->innerHtml);
}
public function testOuterHtml()
{
$div = new Tag('div');
$div->setAttributes([
'class' => [
'value' => 'all',
'doubleQuote' => true,
],
]);
$a = new Tag('a');
$a->setAttributes([
'href' => [
'value' => 'http://google.com',
'doubleQuote' => false,
],
]);
$br = new Tag('br');
$br->selfClosing();
$parent = new HtmlNode($div);
$childa = new HtmlNode($a);
$childbr = new HtmlNode($br);
$parent->addChild($childa);
$parent->addChild($childbr);
$childa->addChild(new TextNode('link'));
$this->assertEquals('', $parent->outerHtml());
}
public function testOuterHtmlTwice()
{
$div = new Tag('div');
$div->setAttributes([
'class' => [
'value' => 'all',
'doubleQuote' => true,
],
]);
$a = new Tag('a');
$a->setAttributes([
'href' => [
'value' => 'http://google.com',
'doubleQuote' => false,
],
]);
$br = new Tag('br');
$br->selfClosing();
$parent = new HtmlNode($div);
$childa = new HtmlNode($a);
$childbr = new HtmlNode($br);
$parent->addChild($childa);
$parent->addChild($childbr);
$childa->addChild(new TextNode('link'));
$outer = $parent->outerHtml();
$this->assertEquals($outer, $parent->outerHtml());
}
public function testOuterHtmlEmpty()
{
$a = new Tag('a');
$a->setAttributes([
'href' => [
'value' => 'http://google.com',
'doubleQuote' => false,
],
]);
$node = new HtmlNode($a);
$this->assertEquals("", $node->OuterHtml());
}
public function testOuterHtmlMagic()
{
$parent = new HtmlNode('div');
$parent->getTag()->setAttributes([
'class' => [
'value' => 'all',
'doubleQuote' => true,
],
]);
$childa = new HtmlNode('a');
$childa->getTag()->setAttributes([
'href' => [
'value' => 'http://google.com',
'doubleQuote' => false,
],
]);
$childbr = new HtmlNode('br');
$childbr->getTag()->selfClosing();
$parent->addChild($childa);
$parent->addChild($childbr);
$childa->addChild(new TextNode('link'));
$this->assertEquals('', $parent->outerHtml);
}
public function testOuterHtmlNoValueAttribute()
{
$parent = new HtmlNode('div');
$parent->setAttribute('class', [
'value' => 'all',
'doubleQuote' => true,
]);
$childa = new HtmlNode('a');
$childa->setAttribute('href', [
'value' => 'http://google.com',
'doubleQuote' => false,
]);
$childa->setAttribute('ui-view', null);
$childbr = new HtmlNode('br');
$childbr->getTag()->selfClosing();
$parent->addChild($childa);
$parent->addChild($childbr);
$childa->addChild(new TextNode('link'));
$this->assertEquals('', $parent->outerHtml);
}
public function testText()
{
$a = new Tag('a');
$node = new HtmlNode($a);
$node->addChild(new TextNode('link'));
$this->assertEquals('link', $node->text());
}
public function testTextTwice()
{
$a = new Tag('a');
$node = new HtmlNode($a);
$node->addChild(new TextNode('link'));
$text = $node->text();
$this->assertEquals($text, $node->text());
}
public function testTextNone()
{
$a = new Tag('a');
$node = new HtmlNode($a);
$this->assertEmpty($node->text());
}
public function testTextMagic()
{
$node = new HtmlNode('a');
$node->addChild(new TextNode('link'));
$this->assertEquals('link', $node->text);
}
public function testTextLookInChildren()
{
$p = new HtmlNode('p');
$a = new HtmlNode('a');
$a->addChild(new TextNode('click me'));
$p->addChild(new TextNode('Please '));
$p->addChild($a);
$p->addChild(new TextNode('!'));
$node = new HtmlNode('div');
$node->addChild($p);
$this->assertEquals('Please click me!', $node->text(true));
}
public function testTextLookInChildrenAndNoChildren()
{
$p = new HtmlNode('p');
$a = new HtmlNode('a');
$a->addChild(new TextNode('click me'));
$p->addChild(new TextNode('Please '));
$p->addChild($a);
$p->addChild(new TextNode('!'));
$p->text;
$p->text(true);
$this->assertEquals('Please click me!', $p->text(true));
}
public function testGetAttribute()
{
$node = new HtmlNode('a');
$node->getTag()->setAttributes([
'href' => [
'value' => 'http://google.com',
'doubleQuote' => false,
],
'class' => [
'value' => 'outerlink rounded',
'doubleQuote' => true,
],
]);
$this->assertEquals('outerlink rounded', $node->getAttribute('class'));
}
public function testGetAttributeMagic()
{
$node = new HtmlNode('a');
$node->getTag()->setAttributes([
'href' => [
'value' => 'http://google.com',
'doubleQuote' => false,
],
'class' => [
'value' => 'outerlink rounded',
'doubleQuote' => true,
],
]);
$this->assertEquals('http://google.com', $node->href);
}
public function testGetAttributes()
{
$node = new HtmlNode('a');
$node->getTag()->setAttributes([
'href' => [
'value' => 'http://google.com',
'doubleQuote' => false,
],
'class' => [
'value' => 'outerlink rounded',
'doubleQuote' => true,
],
]);
$this->assertEquals('outerlink rounded', $node->getAttributes()['class']);
}
public function testSetAttribute()
{
$node = new HtmlNode('a');
$node->setAttribute('class', 'foo');
$this->assertEquals('foo', $node->getAttribute('class'));
}
public function testRemoveAttribute()
{
$node = new HtmlNode('a');
$node->setAttribute('class', 'foo');
$node->removeAttribute('class');
$this->assertnull($node->getAttribute('class'));
}
public function testRemoveAllAttributes()
{
$node = new HtmlNode('a');
$node->setAttribute('class', 'foo');
$node->setAttribute('href', 'http://google.com');
$node->removeAllAttributes();
$this->assertEquals(0, count($node->getAttributes()));
}
public function testCountable()
{
$div = new Tag('div');
$div->setAttributes([
'class' => [
'value' => 'all',
'doubleQuote' => true,
],
]);
$a = new Tag('a');
$a->setAttributes([
'href' => [
'value' => 'http://google.com',
'doubleQuote' => false,
],
]);
$br = new Tag('br');
$br->selfClosing();
$parent = new HtmlNode($div);
$childa = new HtmlNode($a);
$childbr = new HtmlNode($br);
$parent->addChild($childa);
$parent->addChild($childbr);
$childa->addChild(new TextNode('link'));
$this->assertEquals(count($parent->getChildren()), count($parent));
}
public function testIterator()
{
$div = new Tag('div');
$div->setAttributes([
'class' => [
'value' => 'all',
'doubleQuote' => true,
],
]);
$a = new Tag('a');
$a->setAttributes([
'href' => [
'value' => 'http://google.com',
'doubleQuote' => false,
],
]);
$br = new Tag('br');
$br->selfClosing();
$parent = new HtmlNode($div);
$childa = new HtmlNode($a);
$childbr = new HtmlNode($br);
$parent->addChild($childa);
$parent->addChild($childbr);
$childa->addChild(new TextNode('link'));
$children = 0;
foreach ($parent as $child) {
++$children;
}
$this->assertEquals(2, $children);
}
/**
* @expectedException PHPHtmlParser\Exceptions\ParentNotFoundException
*/
public function testAncestorByTagFailure()
{
$a = new Tag('a');
$node = new HtmlNode($a);
$node->ancestorByTag('div');
}
}
PK ! Nu ChildrenTest.phpnu Iw setParent($parent);
$this->assertEquals($parent->id(), $child->getParent()->id());
}
public function testSetParentTwice()
{
$parent = new Node;
$parent2 = new Node;
$child = new Node;
$child->setParent($parent);
$child->setParent($parent2);
$this->assertEquals($parent2->id(), $child->getParent()->id());
}
public function testNextSibling()
{
$parent = new Node;
$child = new Node;
$child2 = new Node;
$child->setParent($parent);
$child2->setParent($parent);
$this->assertEquals($child2->id(), $child->nextSibling()->id());
}
/**
* @expectedException PHPHtmlParser\Exceptions\ChildNotFoundException
*/
public function testNextSiblingNotFound()
{
$parent = new Node;
$child = new Node;
$child->setParent($parent);
$child->nextSibling();
}
/**
* @expectedException PHPHtmlParser\Exceptions\ParentNotFoundException
*/
public function testNextSiblingNoParent()
{
$child = new Node;
$child->nextSibling();
}
public function testPreviousSibling()
{
$parent = new Node;
$child = new Node;
$child2 = new Node;
$child->setParent($parent);
$child2->setParent($parent);
$this->assertEquals($child->id(), $child2->previousSibling()->id());
}
/**
* @expectedException PHPHtmlParser\Exceptions\ChildNotFoundException
*/
public function testPreviousSiblingNotFound()
{
$parent = new Node;
$node = new Node;
$node->setParent($parent);
$node->previousSibling();
}
/**
* @expectedException PHPHtmlParser\Exceptions\ParentNotFoundException
*/
public function testPreviousSiblingNoParent()
{
$child = new Node;
$child->previousSibling();
}
public function testGetChildren()
{
$parent = new Node;
$child = new Node;
$child2 = new Node;
$child->setParent($parent);
$child2->setParent($parent);
$this->assertEquals($child->id(), $parent->getChildren()[0]->id());
}
public function testCountChildren()
{
$parent = new Node;
$child = new Node;
$child2 = new Node;
$child->setParent($parent);
$child2->setParent($parent);
$this->assertEquals(2, $parent->countChildren());
}
public function testIsChild ()
{
$parent = new Node;
$child1 = new Node;
$child2 = new Node;
$child1->setParent($parent);
$child2->setParent($child1);
$this->assertTrue ($parent->isChild ($child1->id ()));
$this->assertTrue ($parent->isDescendant ($child2->id ()));
$this->assertFalse ($parent->isChild ($child2->id ()));
}
}
PK ! b TextTest.phpnu Iw assertEquals('foo bar', $node->text());
}
public function testGetTag()
{
$node = new TextNode('foo bar');
$this->assertEquals('text', $node->getTag()->name());
}
public function testAncestorByTag()
{
$node = new TextNode('foo bar');
$text = $node->ancestorByTag('text');
$this->assertEquals($node, $text);
}
public function testPreserveEntity()
{
$node = new TextNode('i');
$text = $node->innerhtml;
$this->assertEquals('i', $text);
}
}
PK !
Node.phpnu Iw
*
* Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js)
* - (c) John MacFarlane
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace League\CommonMark\Node;
abstract class Node
{
/**
* @var int
*/
protected $depth = 0;
/**
* @var Node|null
*/
protected $parent;
/**
* @var Node|null
*/
protected $previous;
/**
* @var Node|null
*/
protected $next;
/**
* @var Node|null
*/
protected $firstChild;
/**
* @var Node|null
*/
protected $lastChild;
/**
* @return Node|null
*/
public function previous(): ?Node
{
return $this->previous;
}
/**
* @return Node|null
*/
public function next(): ?Node
{
return $this->next;
}
/**
* @return Node|null
*/
public function parent(): ?Node
{
return $this->parent;
}
/**
* @param Node|null $node
*/
protected function setParent(Node $node = null)
{
$this->parent = $node;
$this->depth = ($node === null) ? 0 : $node->depth + 1;
}
/**
* Inserts the $sibling node after $this
*
* @param Node $sibling
*/
public function insertAfter(Node $sibling)
{
$sibling->detach();
$sibling->next = $this->next;
if ($sibling->next) {
$sibling->next->previous = $sibling;
}
$sibling->previous = $this;
$this->next = $sibling;
$sibling->setParent($this->parent);
if (!$sibling->next && $sibling->parent) {
$sibling->parent->lastChild = $sibling;
}
}
/**
* Inserts the $sibling node before $this
*
* @param Node $sibling
*/
public function insertBefore(Node $sibling)
{
$sibling->detach();
$sibling->previous = $this->previous;
if ($sibling->previous) {
$sibling->previous->next = $sibling;
}
$sibling->next = $this;
$this->previous = $sibling;
$sibling->setParent($this->parent);
if (!$sibling->previous && $sibling->parent) {
$sibling->parent->firstChild = $sibling;
}
}
public function replaceWith(Node $replacement)
{
$replacement->detach();
$this->insertAfter($replacement);
$this->detach();
}
public function detach()
{
if ($this->previous) {
$this->previous->next = $this->next;
} elseif ($this->parent) {
$this->parent->firstChild = $this->next;
}
if ($this->next) {
$this->next->previous = $this->previous;
} elseif ($this->parent) {
$this->parent->lastChild = $this->previous;
}
$this->parent = null;
$this->next = null;
$this->previous = null;
$this->depth = 0;
}
/**
* @return bool
*/
abstract public function isContainer(): bool;
/**
* @return Node|null
*/
public function firstChild(): ?Node
{
return $this->firstChild;
}
/**
* @return Node|null
*/
public function lastChild(): ?Node
{
return $this->lastChild;
}
/**
* @return Node[]
*/
public function children(): iterable
{
$children = [];
for ($current = $this->firstChild; null !== $current; $current = $current->next) {
$children[] = $current;
}
return $children;
}
/**
* @param Node $child
*/
public function appendChild(Node $child)
{
if ($this->lastChild) {
$this->lastChild->insertAfter($child);
} else {
$child->detach();
$child->setParent($this);
$this->lastChild = $this->firstChild = $child;
}
}
/**
* Adds $child as the very first child of $this
*
* @param Node $child
*/
public function prependChild(Node $child)
{
if ($this->firstChild) {
$this->firstChild->insertBefore($child);
} else {
$child->detach();
$child->setParent($this);
$this->lastChild = $this->firstChild = $child;
}
}
/**
* Detaches all child nodes of given node
*/
public function detachChildren()
{
foreach ($this->children() as $children) {
$children->setParent(null);
}
$this->firstChild = $this->lastChild = null;
}
/**
* Replace all children of given node with collection of another
*
* @param iterable $children
*
* @return $this
*/
public function replaceChildren(iterable $children)
{
$this->detachChildren();
foreach ($children as $item) {
$this->appendChild($item);
}
return $this;
}
/**
* @return int
*/
public function getDepth(): int
{
return $this->depth;
}
/**
* @return NodeWalker
*/
public function walker(): NodeWalker
{
return new NodeWalker($this);
}
}
PK ! u*, NodeWalkerEvent.phpnu Iw
*
* Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js)
* - (c) John MacFarlane
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace League\CommonMark\Node;
final class NodeWalkerEvent
{
/**
* @var Node
*/
private $node;
/**
* @var bool
*/
private $isEntering;
/**
* @param Node $node
* @param bool $isEntering
*/
public function __construct(Node $node, $isEntering = true)
{
$this->node = $node;
$this->isEntering = $isEntering;
}
/**
* @return Node
*/
public function getNode(): Node
{
return $this->node;
}
/**
* @return bool
*/
public function isEntering(): bool
{
return $this->isEntering;
}
}
PK ! {z z NodeWalker.phpnu Iw
*
* Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js)
* - (c) John MacFarlane
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace League\CommonMark\Node;
final class NodeWalker
{
/**
* @var Node
*/
private $root;
/**
* @var Node|null
*/
private $current;
/**
* @var bool
*/
private $entering;
/**
* @param Node $root
*/
public function __construct(Node $root)
{
$this->root = $root;
$this->current = $this->root;
$this->entering = true;
}
/**
* Returns an event which contains node and entering flag
* (entering is true when we enter a Node from a parent or sibling,
* and false when we reenter it from child)
*
* @return NodeWalkerEvent|null
*/
public function next(): ?NodeWalkerEvent
{
$current = $this->current;
$entering = $this->entering;
if (null === $current) {
return null;
}
if ($entering && $current->isContainer()) {
if ($current->firstChild()) {
$this->current = $current->firstChild();
$this->entering = true;
} else {
$this->entering = false;
}
} elseif ($current === $this->root) {
$this->current = null;
} elseif (null === $current->next()) {
$this->current = $current->parent();
$this->entering = false;
} else {
$this->current = $current->next();
$this->entering = true;
}
return new NodeWalkerEvent($current, $entering);
}
/**
* Resets the iterator to resume at the specified node
*
* @param Node $node
* @param bool $entering
*/
public function resumeAt(Node $node, bool $entering = true)
{
$this->current = $node;
$this->entering = $entering;
}
}
PK ! JW VarLikeIdentifier.phpnu [ $attributes Additional attributes
*/
public function __construct($name, Expr $value, array $attributes = []) {
$this->attributes = $attributes;
$this->name = \is_string($name) ? new Identifier($name) : $name;
$this->value = $value;
}
public function getSubNodeNames(): array {
return ['name', 'value'];
}
public function getType(): string {
return 'Const';
}
}
PK ! Ii
NullableType.phpnu [ $attributes Additional attributes
*/
public function __construct(Node $type, array $attributes = []) {
$this->attributes = $attributes;
$this->type = $type;
}
public function getSubNodeNames(): array {
return ['type'];
}
public function getType(): string {
return 'NullableType';
}
}
PK ! kQKb b
Scalar.phpnu [ $attributes Additional attributes
*/
public function __construct(array $types, array $attributes = []) {
$this->attributes = $attributes;
$this->types = $types;
}
public function getSubNodeNames(): array {
return ['types'];
}
public function getType(): string {
return 'UnionType';
}
}
PK ! '+ Arg.phpnu [ $attributes Additional attributes
* @param Identifier|null $name Parameter name (for named parameters)
*/
public function __construct(
Expr $value, bool $byRef = false, bool $unpack = false, array $attributes = [],
?Identifier $name = null
) {
$this->attributes = $attributes;
$this->name = $name;
$this->value = $value;
$this->byRef = $byRef;
$this->unpack = $unpack;
}
public function getSubNodeNames(): array {
return ['name', 'value', 'byRef', 'unpack'];
}
public function getType(): string {
return 'Arg';
}
}
PK ! <#E E Identifier.phpnu [ */
private static array $specialClassNames = [
'self' => true,
'parent' => true,
'static' => true,
];
/**
* Constructs an identifier node.
*
* @param string $name Identifier as string
* @param array $attributes Additional attributes
*/
public function __construct(string $name, array $attributes = []) {
if ($name === '') {
throw new \InvalidArgumentException('Identifier name cannot be empty');
}
$this->attributes = $attributes;
$this->name = $name;
}
public function getSubNodeNames(): array {
return ['name'];
}
/**
* Get identifier as string.
*
* @psalm-return non-empty-string
* @return string Identifier as string.
*/
public function toString(): string {
return $this->name;
}
/**
* Get lowercased identifier as string.
*
* @psalm-return non-empty-string&lowercase-string
* @return string Lowercased identifier as string
*/
public function toLowerString(): string {
return strtolower($this->name);
}
/**
* Checks whether the identifier is a special class name (self, parent or static).
*
* @return bool Whether identifier is a special class name
*/
public function isSpecialClassName(): bool {
return isset(self::$specialClassNames[strtolower($this->name)]);
}
/**
* Get identifier as string.
*
* @psalm-return non-empty-string
* @return string Identifier as string
*/
public function __toString(): string {
return $this->name;
}
public function getType(): string {
return 'Identifier';
}
}
PK ! */ FunctionLike.phpnu [ Escaped character to its decoded value */
protected static array $replacements = [
'\\' => '\\',
'$' => '$',
'n' => "\n",
'r' => "\r",
't' => "\t",
'f' => "\f",
'v' => "\v",
'e' => "\x1B",
];
/**
* Constructs a string scalar node.
*
* @param string $value Value of the string
* @param array $attributes Additional attributes
*/
public function __construct(string $value, array $attributes = []) {
$this->attributes = $attributes;
$this->value = $value;
}
public function getSubNodeNames(): array {
return ['value'];
}
/**
* @param array $attributes
* @param bool $parseUnicodeEscape Whether to parse PHP 7 \u escapes
*/
public static function fromString(string $str, array $attributes = [], bool $parseUnicodeEscape = true): self {
$attributes['kind'] = ($str[0] === "'" || ($str[1] === "'" && ($str[0] === 'b' || $str[0] === 'B')))
? Scalar\String_::KIND_SINGLE_QUOTED
: Scalar\String_::KIND_DOUBLE_QUOTED;
$attributes['rawValue'] = $str;
$string = self::parse($str, $parseUnicodeEscape);
return new self($string, $attributes);
}
/**
* @internal
*
* Parses a string token.
*
* @param string $str String token content
* @param bool $parseUnicodeEscape Whether to parse PHP 7 \u escapes
*
* @return string The parsed string
*/
public static function parse(string $str, bool $parseUnicodeEscape = true): string {
$bLength = 0;
if ('b' === $str[0] || 'B' === $str[0]) {
$bLength = 1;
}
if ('\'' === $str[$bLength]) {
return str_replace(
['\\\\', '\\\''],
['\\', '\''],
substr($str, $bLength + 1, -1)
);
} else {
return self::parseEscapeSequences(
substr($str, $bLength + 1, -1), '"', $parseUnicodeEscape
);
}
}
/**
* @internal
*
* Parses escape sequences in strings (all string types apart from single quoted).
*
* @param string $str String without quotes
* @param null|string $quote Quote type
* @param bool $parseUnicodeEscape Whether to parse PHP 7 \u escapes
*
* @return string String with escape sequences parsed
*/
public static function parseEscapeSequences(string $str, ?string $quote, bool $parseUnicodeEscape = true): string {
if (null !== $quote) {
$str = str_replace('\\' . $quote, $quote, $str);
}
$extra = '';
if ($parseUnicodeEscape) {
$extra = '|u\{([0-9a-fA-F]+)\}';
}
return preg_replace_callback(
'~\\\\([\\\\$nrtfve]|[xX][0-9a-fA-F]{1,2}|[0-7]{1,3}' . $extra . ')~',
function ($matches) {
$str = $matches[1];
if (isset(self::$replacements[$str])) {
return self::$replacements[$str];
}
if ('x' === $str[0] || 'X' === $str[0]) {
return chr(hexdec(substr($str, 1)));
}
if ('u' === $str[0]) {
$dec = hexdec($matches[2]);
// If it overflowed to float, treat as INT_MAX, it will throw an error anyway.
return self::codePointToUtf8(\is_int($dec) ? $dec : \PHP_INT_MAX);
} else {
return chr(octdec($str) & 255);
}
},
$str
);
}
/**
* Converts a Unicode code point to its UTF-8 encoded representation.
*
* @param int $num Code point
*
* @return string UTF-8 representation of code point
*/
private static function codePointToUtf8(int $num): string {
if ($num <= 0x7F) {
return chr($num);
}
if ($num <= 0x7FF) {
return chr(($num >> 6) + 0xC0) . chr(($num & 0x3F) + 0x80);
}
if ($num <= 0xFFFF) {
return chr(($num >> 12) + 0xE0) . chr((($num >> 6) & 0x3F) + 0x80) . chr(($num & 0x3F) + 0x80);
}
if ($num <= 0x1FFFFF) {
return chr(($num >> 18) + 0xF0) . chr((($num >> 12) & 0x3F) + 0x80)
. chr((($num >> 6) & 0x3F) + 0x80) . chr(($num & 0x3F) + 0x80);
}
throw new Error('Invalid UTF-8 codepoint escape sequence: Codepoint too large');
}
public function getType(): string {
return 'Scalar_String';
}
}
PK ! w^ Scalar/EncapsedStringPart.phpnu [ $attributes Additional attributes
*/
public function __construct(array $attributes = []) {
$this->attributes = $attributes;
}
public function getSubNodeNames(): array {
return [];
}
/**
* Get name of magic constant.
*
* @return string Name of magic constant
*/
abstract public function getName(): string;
}
PK ! ]A A Scalar/Encapsed.phpnu [ toString();
}
public function getType(): string {
return 'Name_FullyQualified';
}
}
PK ! lN Name/Relative.phpnu [ toString();
}
public function getType(): string {
return 'Name_Relative';
}
}
PK ! }序 Expr.phpnu [ $attributes Additional attributes
*/
public function __construct(array $vars, array $attributes = []) {
$this->attributes = $attributes;
$this->vars = $vars;
}
public function getSubNodeNames(): array {
return ['vars'];
}
public function getType(): string {
return 'Stmt_Static';
}
}
PK ! fu= Stmt/Const_.phpnu [ $attributes Additional attributes
* @param list $attrGroups PHP attribute groups
*/
public function __construct(
array $consts,
array $attributes = [],
array $attrGroups = []
) {
$this->attributes = $attributes;
$this->attrGroups = $attrGroups;
$this->consts = $consts;
}
public function getSubNodeNames(): array {
return ['attrGroups', 'consts'];
}
public function getType(): string {
return 'Stmt_Const';
}
}
PK ! b
b
Stmt/Property.phpnu [ $attributes Additional attributes
* @param null|Identifier|Name|ComplexType $type Type declaration
* @param Node\AttributeGroup[] $attrGroups PHP attribute groups
* @param Node\PropertyHook[] $hooks Property hooks
*/
public function __construct(int $flags, array $props, array $attributes = [], ?Node $type = null, array $attrGroups = [], array $hooks = []) {
$this->attributes = $attributes;
$this->flags = $flags;
$this->props = $props;
$this->type = $type;
$this->attrGroups = $attrGroups;
$this->hooks = $hooks;
}
public function getSubNodeNames(): array {
return ['attrGroups', 'flags', 'type', 'props', 'hooks'];
}
/**
* Whether the property is explicitly or implicitly public.
*/
public function isPublic(): bool {
return ($this->flags & Modifiers::PUBLIC) !== 0
|| ($this->flags & Modifiers::VISIBILITY_MASK) === 0;
}
/**
* Whether the property is protected.
*/
public function isProtected(): bool {
return (bool) ($this->flags & Modifiers::PROTECTED);
}
/**
* Whether the property is private.
*/
public function isPrivate(): bool {
return (bool) ($this->flags & Modifiers::PRIVATE);
}
/**
* Whether the property is static.
*/
public function isStatic(): bool {
return (bool) ($this->flags & Modifiers::STATIC);
}
/**
* Whether the property is readonly.
*/
public function isReadonly(): bool {
return (bool) ($this->flags & Modifiers::READONLY);
}
/**
* Whether the property is abstract.
*/
public function isAbstract(): bool {
return (bool) ($this->flags & Modifiers::ABSTRACT);
}
/**
* Whether the property is final.
*/
public function isFinal(): bool {
return (bool) ($this->flags & Modifiers::FINAL);
}
/**
* Whether the property has explicit public(set) visibility.
*/
public function isPublicSet(): bool {
return (bool) ($this->flags & Modifiers::PUBLIC_SET);
}
/**
* Whether the property has explicit protected(set) visibility.
*/
public function isProtectedSet(): bool {
return (bool) ($this->flags & Modifiers::PROTECTED_SET);
}
/**
* Whether the property has explicit private(set) visibility.
*/
public function isPrivateSet(): bool {
return (bool) ($this->flags & Modifiers::PRIVATE_SET);
}
public function getType(): string {
return 'Stmt_Property';
}
}
PK ! kj Stmt/Expression.phpnu [ $attributes Additional attributes
*/
public function __construct(Node\Expr $expr, array $attributes = []) {
$this->attributes = $attributes;
$this->expr = $expr;
}
public function getSubNodeNames(): array {
return ['expr'];
}
public function getType(): string {
return 'Stmt_Expression';
}
}
PK ! M M Stmt/DeclareDeclare.phpnu [ $attributes Additional attributes
*/
public function __construct(array $uses, int $type = self::TYPE_NORMAL, array $attributes = []) {
$this->attributes = $attributes;
$this->type = $type;
$this->uses = $uses;
}
public function getSubNodeNames(): array {
return ['type', 'uses'];
}
public function getType(): string {
return 'Stmt_Use';
}
}
PK ! q Stmt/Return_.phpnu [ $attributes Additional attributes
*/
public function __construct(?Node\Expr $expr = null, array $attributes = []) {
$this->attributes = $attributes;
$this->expr = $expr;
}
public function getSubNodeNames(): array {
return ['expr'];
}
public function getType(): string {
return 'Stmt_Return';
}
}
PK ! ;6}
Stmt/For_.phpnu [ array(): Init expressions
* 'cond' => array(): Loop conditions
* 'loop' => array(): Loop expressions
* 'stmts' => array(): Statements
* @param array $attributes Additional attributes
*/
public function __construct(array $subNodes = [], array $attributes = []) {
$this->attributes = $attributes;
$this->init = $subNodes['init'] ?? [];
$this->cond = $subNodes['cond'] ?? [];
$this->loop = $subNodes['loop'] ?? [];
$this->stmts = $subNodes['stmts'] ?? [];
}
public function getSubNodeNames(): array {
return ['init', 'cond', 'loop', 'stmts'];
}
public function getType(): string {
return 'Stmt_For';
}
}
PK ! )M)- - Stmt/Interface_.phpnu [ array(): Name of extended interfaces
* 'stmts' => array(): Statements
* 'attrGroups' => array(): PHP attribute groups
* @param array $attributes Additional attributes
*/
public function __construct($name, array $subNodes = [], array $attributes = []) {
$this->attributes = $attributes;
$this->name = \is_string($name) ? new Node\Identifier($name) : $name;
$this->extends = $subNodes['extends'] ?? [];
$this->stmts = $subNodes['stmts'] ?? [];
$this->attrGroups = $subNodes['attrGroups'] ?? [];
}
public function getSubNodeNames(): array {
return ['attrGroups', 'name', 'extends', 'stmts'];
}
public function getType(): string {
return 'Stmt_Interface';
}
}
PK ! r: : Stmt/ElseIf_.phpnu [ $attributes Additional attributes
*/
public function __construct(Node\Expr $cond, array $stmts = [], array $attributes = []) {
$this->attributes = $attributes;
$this->cond = $cond;
$this->stmts = $stmts;
}
public function getSubNodeNames(): array {
return ['cond', 'stmts'];
}
public function getType(): string {
return 'Stmt_ElseIf';
}
}
PK ! Zce e Stmt/Case_.phpnu [ $attributes Additional attributes
*/
public function __construct(?Node\Expr $cond, array $stmts = [], array $attributes = []) {
$this->attributes = $attributes;
$this->cond = $cond;
$this->stmts = $stmts;
}
public function getSubNodeNames(): array {
return ['cond', 'stmts'];
}
public function getType(): string {
return 'Stmt_Case';
}
}
PK ! oJ Stmt/Goto_.phpnu [ $attributes Additional attributes
*/
public function __construct($name, array $attributes = []) {
$this->attributes = $attributes;
$this->name = \is_string($name) ? new Identifier($name) : $name;
}
public function getSubNodeNames(): array {
return ['name'];
}
public function getType(): string {
return 'Stmt_Goto';
}
}
PK ! ' ' Stmt/Nop.phpnu [ $attributes Additional attributes
*/
public function __construct(array $stmts = [], array $attributes = []) {
$this->attributes = $attributes;
$this->stmts = $stmts;
}
public function getSubNodeNames(): array {
return ['stmts'];
}
public function getType(): string {
return 'Stmt_Else';
}
}
PK ! 5 Stmt/HaltCompiler.phpnu [ $attributes Additional attributes
*/
public function __construct(string $remaining, array $attributes = []) {
$this->attributes = $attributes;
$this->remaining = $remaining;
}
public function getSubNodeNames(): array {
return ['remaining'];
}
public function getType(): string {
return 'Stmt_HaltCompiler';
}
}
PK ! )% % Stmt/TraitUseAdaptation.phpnu [ $attributes Additional attributes
*/
public function __construct($name, array $attributes = []) {
$this->attributes = $attributes;
$this->name = \is_string($name) ? new Identifier($name) : $name;
}
public function getSubNodeNames(): array {
return ['name'];
}
public function getType(): string {
return 'Stmt_Label';
}
}
PK ! _^W Stmt/Unset_.phpnu [ $attributes Additional attributes
*/
public function __construct(array $vars, array $attributes = []) {
$this->attributes = $attributes;
$this->vars = $vars;
}
public function getSubNodeNames(): array {
return ['vars'];
}
public function getType(): string {
return 'Stmt_Unset';
}
}
PK ! 9t3 3 Stmt/Do_.phpnu [ $attributes Additional attributes
*/
public function __construct(Node\Expr $cond, array $stmts = [], array $attributes = []) {
$this->attributes = $attributes;
$this->cond = $cond;
$this->stmts = $stmts;
}
public function getSubNodeNames(): array {
return ['stmts', 'cond'];
}
public function getType(): string {
return 'Stmt_Do';
}
}
PK ! }]Z Z Stmt/Catch_.phpnu [ $attributes Additional attributes
*/
public function __construct(
array $types, ?Expr\Variable $var = null, array $stmts = [], array $attributes = []
) {
$this->attributes = $attributes;
$this->types = $types;
$this->var = $var;
$this->stmts = $stmts;
}
public function getSubNodeNames(): array {
return ['types', 'var', 'stmts'];
}
public function getType(): string {
return 'Stmt_Catch';
}
}
PK ! UޜT T Stmt/ClassConst.phpnu [ $attributes Additional attributes
* @param list $attrGroups PHP attribute groups
* @param null|Node\Identifier|Node\Name|Node\ComplexType $type Type declaration
*/
public function __construct(
array $consts,
int $flags = 0,
array $attributes = [],
array $attrGroups = [],
?Node $type = null
) {
$this->attributes = $attributes;
$this->flags = $flags;
$this->consts = $consts;
$this->attrGroups = $attrGroups;
$this->type = $type;
}
public function getSubNodeNames(): array {
return ['attrGroups', 'flags', 'type', 'consts'];
}
/**
* Whether constant is explicitly or implicitly public.
*/
public function isPublic(): bool {
return ($this->flags & Modifiers::PUBLIC) !== 0
|| ($this->flags & Modifiers::VISIBILITY_MASK) === 0;
}
/**
* Whether constant is protected.
*/
public function isProtected(): bool {
return (bool) ($this->flags & Modifiers::PROTECTED);
}
/**
* Whether constant is private.
*/
public function isPrivate(): bool {
return (bool) ($this->flags & Modifiers::PRIVATE);
}
/**
* Whether constant is final.
*/
public function isFinal(): bool {
return (bool) ($this->flags & Modifiers::FINAL);
}
public function getType(): string {
return 'Stmt_ClassConst';
}
}
PK ! ݯM Stmt/TryCatch.phpnu [ $attributes Additional attributes
*/
public function __construct(array $stmts, array $catches, ?Finally_ $finally = null, array $attributes = []) {
$this->attributes = $attributes;
$this->stmts = $stmts;
$this->catches = $catches;
$this->finally = $finally;
}
public function getSubNodeNames(): array {
return ['stmts', 'catches', 'finally'];
}
public function getType(): string {
return 'Stmt_TryCatch';
}
}
PK ! |/ / Stmt/Trait_.phpnu [ array(): Statements
* 'attrGroups' => array(): PHP attribute groups
* @param array $attributes Additional attributes
*/
public function __construct($name, array $subNodes = [], array $attributes = []) {
$this->attributes = $attributes;
$this->name = \is_string($name) ? new Node\Identifier($name) : $name;
$this->stmts = $subNodes['stmts'] ?? [];
$this->attrGroups = $subNodes['attrGroups'] ?? [];
}
public function getSubNodeNames(): array {
return ['attrGroups', 'name', 'stmts'];
}
public function getType(): string {
return 'Stmt_Trait';
}
}
PK ! o Stmt/InlineHTML.phpnu [ $attributes Additional attributes
*/
public function __construct(string $value, array $attributes = []) {
$this->attributes = $attributes;
$this->value = $value;
}
public function getSubNodeNames(): array {
return ['value'];
}
public function getType(): string {
return 'Stmt_InlineHTML';
}
}
PK ! gM Stmt/Declare_.phpnu [ $attributes Additional attributes
*/
public function __construct(array $declares, ?array $stmts = null, array $attributes = []) {
$this->attributes = $attributes;
$this->declares = $declares;
$this->stmts = $stmts;
}
public function getSubNodeNames(): array {
return ['declares', 'stmts'];
}
public function getType(): string {
return 'Stmt_Declare';
}
}
PK ! X Stmt/Global_.phpnu [ $attributes Additional attributes
*/
public function __construct(array $vars, array $attributes = []) {
$this->attributes = $attributes;
$this->vars = $vars;
}
public function getSubNodeNames(): array {
return ['vars'];
}
public function getType(): string {
return 'Stmt_Global';
}
}
PK ! < Stmt/ClassLike.phpnu [
*/
public function getTraitUses(): array {
$traitUses = [];
foreach ($this->stmts as $stmt) {
if ($stmt instanceof TraitUse) {
$traitUses[] = $stmt;
}
}
return $traitUses;
}
/**
* @return list
*/
public function getConstants(): array {
$constants = [];
foreach ($this->stmts as $stmt) {
if ($stmt instanceof ClassConst) {
$constants[] = $stmt;
}
}
return $constants;
}
/**
* @return list
*/
public function getProperties(): array {
$properties = [];
foreach ($this->stmts as $stmt) {
if ($stmt instanceof Property) {
$properties[] = $stmt;
}
}
return $properties;
}
/**
* Gets property with the given name defined directly in this class/interface/trait.
*
* @param string $name Name of the property
*
* @return Property|null Property node or null if the property does not exist
*/
public function getProperty(string $name): ?Property {
foreach ($this->stmts as $stmt) {
if ($stmt instanceof Property) {
foreach ($stmt->props as $prop) {
if ($prop instanceof PropertyItem && $name === $prop->name->toString()) {
return $stmt;
}
}
}
}
return null;
}
/**
* Gets all methods defined directly in this class/interface/trait
*
* @return list
*/
public function getMethods(): array {
$methods = [];
foreach ($this->stmts as $stmt) {
if ($stmt instanceof ClassMethod) {
$methods[] = $stmt;
}
}
return $methods;
}
/**
* Gets method with the given name defined directly in this class/interface/trait.
*
* @param string $name Name of the method (compared case-insensitively)
*
* @return ClassMethod|null Method node or null if the method does not exist
*/
public function getMethod(string $name): ?ClassMethod {
$lowerName = strtolower($name);
foreach ($this->stmts as $stmt) {
if ($stmt instanceof ClassMethod && $lowerName === $stmt->name->toLowerString()) {
return $stmt;
}
}
return null;
}
}
PK ! >6 6 Stmt/While_.phpnu [ $attributes Additional attributes
*/
public function __construct(Node\Expr $cond, array $stmts = [], array $attributes = []) {
$this->attributes = $attributes;
$this->cond = $cond;
$this->stmts = $stmts;
}
public function getSubNodeNames(): array {
return ['cond', 'stmts'];
}
public function getType(): string {
return 'Stmt_While';
}
}
PK ! F.. Stmt/Throw_.phpnu [ attributes = $attributes;
$this->expr = $expr;
}
public function getSubNodeNames() : array {
return ['expr'];
}
public function getType() : string {
return 'Stmt_Throw';
}
}
PK ! l l Stmt/ClassMethod.phpnu [ */
private static array $magicNames = [
'__construct' => true,
'__destruct' => true,
'__call' => true,
'__callstatic' => true,
'__get' => true,
'__set' => true,
'__isset' => true,
'__unset' => true,
'__sleep' => true,
'__wakeup' => true,
'__tostring' => true,
'__set_state' => true,
'__clone' => true,
'__invoke' => true,
'__debuginfo' => true,
'__serialize' => true,
'__unserialize' => true,
];
/**
* Constructs a class method node.
*
* @param string|Node\Identifier $name Name
* @param array{
* flags?: int,
* byRef?: bool,
* params?: Node\Param[],
* returnType?: null|Node\Identifier|Node\Name|Node\ComplexType,
* stmts?: Node\Stmt[]|null,
* attrGroups?: Node\AttributeGroup[],
* } $subNodes Array of the following optional subnodes:
* 'flags => 0 : Flags
* 'byRef' => false : Whether to return by reference
* 'params' => array() : Parameters
* 'returnType' => null : Return type
* 'stmts' => array() : Statements
* 'attrGroups' => array() : PHP attribute groups
* @param array $attributes Additional attributes
*/
public function __construct($name, array $subNodes = [], array $attributes = []) {
$this->attributes = $attributes;
$this->flags = $subNodes['flags'] ?? $subNodes['type'] ?? 0;
$this->byRef = $subNodes['byRef'] ?? false;
$this->name = \is_string($name) ? new Node\Identifier($name) : $name;
$this->params = $subNodes['params'] ?? [];
$this->returnType = $subNodes['returnType'] ?? null;
$this->stmts = array_key_exists('stmts', $subNodes) ? $subNodes['stmts'] : [];
$this->attrGroups = $subNodes['attrGroups'] ?? [];
}
public function getSubNodeNames(): array {
return ['attrGroups', 'flags', 'byRef', 'name', 'params', 'returnType', 'stmts'];
}
public function returnsByRef(): bool {
return $this->byRef;
}
public function getParams(): array {
return $this->params;
}
public function getReturnType() {
return $this->returnType;
}
public function getStmts(): ?array {
return $this->stmts;
}
public function getAttrGroups(): array {
return $this->attrGroups;
}
/**
* Whether the method is explicitly or implicitly public.
*/
public function isPublic(): bool {
return ($this->flags & Modifiers::PUBLIC) !== 0
|| ($this->flags & Modifiers::VISIBILITY_MASK) === 0;
}
/**
* Whether the method is protected.
*/
public function isProtected(): bool {
return (bool) ($this->flags & Modifiers::PROTECTED);
}
/**
* Whether the method is private.
*/
public function isPrivate(): bool {
return (bool) ($this->flags & Modifiers::PRIVATE);
}
/**
* Whether the method is abstract.
*/
public function isAbstract(): bool {
return (bool) ($this->flags & Modifiers::ABSTRACT);
}
/**
* Whether the method is final.
*/
public function isFinal(): bool {
return (bool) ($this->flags & Modifiers::FINAL);
}
/**
* Whether the method is static.
*/
public function isStatic(): bool {
return (bool) ($this->flags & Modifiers::STATIC);
}
/**
* Whether the method is magic.
*/
public function isMagic(): bool {
return isset(self::$magicNames[$this->name->toLowerString()]);
}
public function getType(): string {
return 'Stmt_ClassMethod';
}
}
PK ! W Stmt/Foreach_.phpnu [ null : Variable to assign key to
* 'byRef' => false : Whether to assign value by reference
* 'stmts' => array(): Statements
* @param array $attributes Additional attributes
*/
public function __construct(Node\Expr $expr, Node\Expr $valueVar, array $subNodes = [], array $attributes = []) {
$this->attributes = $attributes;
$this->expr = $expr;
$this->keyVar = $subNodes['keyVar'] ?? null;
$this->byRef = $subNodes['byRef'] ?? false;
$this->valueVar = $valueVar;
$this->stmts = $subNodes['stmts'] ?? [];
}
public function getSubNodeNames(): array {
return ['expr', 'keyVar', 'byRef', 'valueVar', 'stmts'];
}
public function getType(): string {
return 'Stmt_Foreach';
}
}
PK ! 35 5 Stmt/UseUse.phpnu [ array(): Statements
* 'elseifs' => array(): Elseif clauses
* 'else' => null : Else clause
* @param array $attributes Additional attributes
*/
public function __construct(Node\Expr $cond, array $subNodes = [], array $attributes = []) {
$this->attributes = $attributes;
$this->cond = $cond;
$this->stmts = $subNodes['stmts'] ?? [];
$this->elseifs = $subNodes['elseifs'] ?? [];
$this->else = $subNodes['else'] ?? null;
}
public function getSubNodeNames(): array {
return ['cond', 'stmts', 'elseifs', 'else'];
}
public function getType(): string {
return 'Stmt_If';
}
}
PK ! DA Stmt/Continue_.phpnu [ $attributes Additional attributes
*/
public function __construct(?Node\Expr $num = null, array $attributes = []) {
$this->attributes = $attributes;
$this->num = $num;
}
public function getSubNodeNames(): array {
return ['num'];
}
public function getType(): string {
return 'Stmt_Continue';
}
}
PK ! _|491 1 Stmt/StaticVar.phpnu [ $attributes Additional attributes
*/
public function __construct(array $exprs, array $attributes = []) {
$this->attributes = $attributes;
$this->exprs = $exprs;
}
public function getSubNodeNames(): array {
return ['exprs'];
}
public function getType(): string {
return 'Stmt_Echo';
}
}
PK ! _a( ( Stmt/Switch_.phpnu [ $attributes Additional attributes
*/
public function __construct(Node\Expr $cond, array $cases, array $attributes = []) {
$this->attributes = $attributes;
$this->cond = $cond;
$this->cases = $cases;
}
public function getSubNodeNames(): array {
return ['cond', 'cases'];
}
public function getType(): string {
return 'Stmt_Switch';
}
}
PK ! "ES S Stmt/PropertyProperty.phpnu [ A Stmt/Break_.phpnu [ $attributes Additional attributes
*/
public function __construct(?Node\Expr $num = null, array $attributes = []) {
$this->attributes = $attributes;
$this->num = $num;
}
public function getSubNodeNames(): array {
return ['num'];
}
public function getType(): string {
return 'Stmt_Break';
}
}
PK ! ]TS ! Stmt/TraitUseAdaptation/Alias.phpnu [ $attributes Additional attributes
*/
public function __construct(?Node\Name $trait, $method, ?int $newModifier, $newName, array $attributes = []) {
$this->attributes = $attributes;
$this->trait = $trait;
$this->method = \is_string($method) ? new Node\Identifier($method) : $method;
$this->newModifier = $newModifier;
$this->newName = \is_string($newName) ? new Node\Identifier($newName) : $newName;
}
public function getSubNodeNames(): array {
return ['trait', 'method', 'newModifier', 'newName'];
}
public function getType(): string {
return 'Stmt_TraitUseAdaptation_Alias';
}
}
PK ! !Ұ &