!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/hamcrest/hamcrest-php/generator/   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:     FactoryGenerator.php (2.68 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

/*
 Copyright (c) 2009 hamcrest.org
 */

/**
 * Controls the process of extracting @factory doctags
 * and generating factory method files.
 *
 * Uses File_Iterator to scan for PHP files.
 */
class FactoryGenerator
{
    
/**
     * Path to the Hamcrest PHP files to process.
     *
     * @var string
     */
    
private $path;

    
/**
     * @var array of FactoryFile
     */
    
private $factoryFiles;

    public function 
__construct($path)
    {
        
$this->path $path;
        
$this->factoryFiles = array();
    }

    public function 
addFactoryFile(FactoryFile $factoryFile)
    {
        
$this->factoryFiles[] = $factoryFile;
    }

    public function 
generate()
    {
        
$classes $this->getClassesWithFactoryMethods();
        foreach (
$classes as $class) {
            foreach (
$class->getMethods() as $method) {
                foreach (
$method->getCalls() as $call) {
                    foreach (
$this->factoryFiles as $file) {
                        
$file->addCall($call);
                    }
                }
            }
        }
    }

    public function 
write()
    {
        foreach (
$this->factoryFiles as $file) {
            
$file->build();
            
$file->write();
        }
    }

    public function 
getClassesWithFactoryMethods()
    {
        
$classes = array();
        
$files $this->getSortedFiles();
        foreach (
$files as $file) {
            
$class $this->getFactoryClass($file);
            if (
$class !== null) {
                
$classes[] = $class;
            }
        }

        return 
$classes;
    }

    public function 
getSortedFiles()
    {
        
$iter = \File_Iterator_Factory::getFileIterator($this->path'.php');
        
$files = array();
        foreach (
$iter as $file) {
            
$files[] = $file;
        }
        
sort($filesSORT_STRING);

        return 
$files;
    }

    public function 
getFactoryClass($file)
    {
        
$name $this->getFactoryClassName($file);
        if (
$name !== null) {
            require_once 
$file;

            if (
class_exists($name)) {
                
$class = new FactoryClass(substr($filestrpos($file'Hamcrest/')), new ReflectionClass($name));
                if (
$class->isFactory()) {
                    return 
$class;
                }
            }
        }

        return 
null;
    }

    public function 
getFactoryClassName($file)
    {
        
$content file_get_contents($file);
        if (
preg_match('/namespace\s+(.+);/'$content$namespace)
            && 
preg_match('/\n\s*class\s+(\w+)\s+extends\b/'$content$className)
            && 
preg_match('/@factory\b/'$content)
        ) {
            return 
$namespace[1] . '\\' $className[1];
        }

        return 
null;
    }
}

:: 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.0131 ]--