!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/classify.picotech.app/public_html/vendor/nicmart/tree/src/Node/   drwxr-xr-x
Free 29.12 GB of 117.98 GB (24.69%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     NodeTrait.php (4.35 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

/**
 * Copyright (c) 2013-2020 Nicolò Martini
 *
 * For the full copyright and license information, please view
 * the LICENSE.md file that was distributed with this source code.
 *
 * @see https://github.com/nicmart/Tree
 */

namespace Tree\Node;

use 
Tree\Visitor\Visitor;

trait 
NodeTrait
{
    
/**
     * @var mixed
     */
    
private $value;

    
/**
     * parent.
     *
     * @var NodeInterface
     */
    
private $parent;

    
/**
     * @var NodeInterface[]
     */
    
private $children = [];

    public function 
setValue($value)
    {
        
$this->value $value;

        return 
$this;
    }

    public function 
getValue()
    {
        return 
$this->value;
    }

    public function 
addChild(NodeInterface $child)
    {
        
$child->setParent($this);
        
$this->children[] = $child;

        return 
$this;
    }

    public function 
removeChild(NodeInterface $child)
    {
        foreach (
$this->children as $key => $myChild) {
            if (
$child === $myChild) {
                unset(
$this->children[$key]);
            }
        }

        
$this->children \array_values($this->children);

        
$child->setParent(null);

        return 
$this;
    }

    public function 
removeAllChildren()
    {
        
$this->setChildren([]);

        return 
$this;
    }

    public function 
getChildren()
    {
        return 
$this->children;
    }

    public function 
setChildren(array $children)
    {
        
$this->removeParentFromChildren();
        
$this->children = [];

        foreach (
$children as $child) {
            
$this->addChild($child);
        }

        return 
$this;
    }

    public function 
setParent(?NodeInterface $parent null)
    {
        
$this->parent $parent;
    }

    public function 
getParent()
    {
        return 
$this->parent;
    }

    public function 
getAncestors()
    {
        
$parents = [];
        
$node $this;

        while (
$parent $node->getParent()) {
            
\array_unshift($parents$parent);
            
$node $parent;
        }

        return 
$parents;
    }

    public function 
getAncestorsAndSelf()
    {
        return 
\array_merge($this->getAncestors(), [$this]);
    }

    public function 
getNeighbors()
    {
        
$neighbors $this->getParent()->getChildren();
        
$current $this;

        return 
\array_values(
            
\array_filter(
                
$neighbors,
                static function (
$item) use ($current) {
                    return 
$item !== $current;
                }
            )
        );
    }

    public function 
getNeighborsAndSelf()
    {
        return 
$this->getParent()->getChildren();
    }

    public function 
isLeaf()
    {
        return 
=== \count($this->children);
    }

    
/**
     * @return bool
     */
    
public function isRoot()
    {
        return 
null === $this->getParent();
    }

    public function 
isChild()
    {
        return 
null !== $this->getParent();
    }

    
/**
     * Find the root of the node.
     *
     * @return NodeInterface
     */
    
public function root()
    {
        
$node $this;

        while (
$parent $node->getParent()) {
            
$node $parent;
        }

        return 
$node;
    }

    
/**
     * Return the distance from the current node to the root.
     *
     * Warning, can be expensive, since each descendant is visited
     *
     * @return int
     */
    
public function getDepth()
    {
        if (
$this->isRoot()) {
            return 
0;
        }

        return 
$this->getParent()->getDepth() + 1;
    }

    
/**
     * Return the height of the tree whose root is this node.
     *
     * @return int
     */
    
public function getHeight()
    {
        if (
$this->isLeaf()) {
            return 
0;
        }

        
$heights = [];

        foreach (
$this->getChildren() as $child) {
            
$heights[] = $child->getHeight();
        }

        return 
\max($heights) + 1;
    }

    
/**
     * Return the number of nodes in a tree.
     *
     * @return int
     */
    
public function getSize()
    {
        
$size 1;

        foreach (
$this->getChildren() as $child) {
            
$size += $child->getSize();
        }

        return 
$size;
    }

    public function 
accept(Visitor $visitor)
    {
        return 
$visitor->visit($this);
    }

    private function 
removeParentFromChildren()
    {
        foreach (
$this->getChildren() as $child) {
            
$child->setParent(null);
        }
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0042 ]--