Creates a PHP class from file

@param string $filename
@return PhpClass
178968
public static function fromFile(string $filename): PhpClass {
		$class = new PhpClass();
		$parser = new FileParser($filename);
		$parser->addVisitor(new ClassParserVisitor($class));
		$parser->addVisitor(new MethodParserVisitor($class));
		$parser->addVisitor(new ConstantParserVisitor($class));
		$parser->addVisitor(new PropertyParserVisitor($class));
		$parser->parse();

		return $class;
	}
515577
public function create($className)
        {
            $facade = $this->helper->getFacadeClassName($className);

            if (!class_exists($facade)) {
                throw new RuntimeException("Class '$facade' not found");
            }
            $className = $this->helper->getSDKClassName($className);
            return new $facade(new $className($this->httpClient));
        }
1019131
public static function fromFile($filename)
    {
        if (!is_file($filename) || !is_readable($filename)) {
            throw new \LogicException(sprintf('The file "%s" does not exist or is not readable.', $filename));
        }

        $html = file_get_contents($filename);

        return new static($html);
    }
1056751
public static function load( $fileName )
	{
		$file	= new FS_File_Reader( $fileName );
		if( !$file->exists() )
			throw new Exception( "File '".$fileName."' is not existing." );
		$xml	= $file->readString();
		$parser	= new XML_OPML_Parser();
		return $parser->parse( $xml );
	}
189585
public static function fromFile($fileName) {
        if (!file_exists($fileName))
            throw new SettingsException("file $fileName does not exist");
        return static::fromString(file_get_contents($fileName), dirname($fileName));
    }
276797
public static function fromFile($filename): self
    {
        if (!is_readable($filename) ||
             false === ($str = file_get_contents($filename))) {
            throw new \RuntimeException("Failed to read $filename.");
        }
        return self::fromString($str);
    }
779223
public static function mapClassNameToFileName($className)
    {
        $arr = preg_split('/(?=[A-Z])/', $className);
        unset($arr[0]); // remove the first element ('')
        $fileName = static::getCurrentTimestamp() . '_' . strtolower(implode($arr, '_')) . '.php';

        return $fileName;
    }
175395
public static function fromFile(string $filename = ''): self
    {
        if (!\file_exists($filename)) {
            throw new \Exception($filename.' does not exist');
        }
        $contents = \file_get_contents($filename);
        if (!\is_string($contents)) {
            throw new \Exception('Could not read file contents');
        }
        return self::fromData($contents);
    }
650037
protected function extend( string$fileName ):self
	{
		$this->parent= new static($this->htsl,$this->buffer->goSide($fileName));

		$this->docType= $this->parent->docType;
		$this->indentation= $this->parent->indentation;

		return $this;
	}
146162
public static function make(string $fileName, array $values = null)
    {
        $valuestore = (new static())->setFileName($fileName);

        if (! is_null($values)) {
            $valuestore->put($values);
        }

        return $valuestore;
    }
429108
public function toFile($filename)
    {
        $filename = Yii::getAlias($filename);
        FileHelper::createDirectory(dirname($filename));
        return $this->toStream(fopen($filename, 'w+'));
    }
433803
public static function fromFile(string $filename): PhpTrait {
		$trait = new PhpTrait();
		$parser = new FileParser($filename);
		$parser->addVisitor(new TraitParserVisitor($trait));
		$parser->addVisitor(new MethodParserVisitor($trait));
		$parser->addVisitor(new ConstantParserVisitor($trait));
		$parser->addVisitor(new PropertyParserVisitor($trait));
		$parser->parse();

		return $trait;
	}
6557
public static function load(string $filename) {
		if(class_exists(Dotenv::class)) {
			$dotenv = new Dotenv($filename);
			$dotenv->load();
		}
	}
1371597
public static function deserialize( $fileName )
	{
		$reader	= new FS_File_Reader( $fileName );
		$xml	= $reader->readString( $fileName );
		return parent::deserialize( $xml ); 
	}
1062746
private function imagecreatefrompsd($fileName)
		# Author:     Tim de Koning
		# Version:    1.3
		# Purpose:    To create an image from a PSD file.
		# Param in:   PSD file to open.
		# Param out:  Return a resource like the other ImageCreateFrom functions
		# Reference:  http://www.kingsquare.nl/phppsdreader
		# Notes:
		#
	{
		if (file_exists($this->psdReaderPath))
		{


			include_once($this->psdReaderPath);

			$psdReader = new PhpPsdReader($fileName);

			if (isset($psdReader->infoArray['error']))
			{
				return '';
			}
			else
			{
				return $psdReader->getImage();
			}
		}
		else
		{
			return false;
		}
	}
605140
public function create($funcName) {
		
		$dirname = dirname(__FILE__).'/functions';
		$filename = "$dirname/Function_$funcName.php";
		if( !file_exists($filename) ) {
					return null;
		}


		require_once "$dirname/Function_$funcName.php";

		$funcClassName = '\\figdice\\classes\\functions\\Function_'.$funcName;

		$reflection = new \ReflectionClass($funcClassName);
		/** @var FigFunction $function */
		$function = $reflection->newInstance();
		return $function;
	}
1225858
public static function loadFromFile($filename)
	{
		$xmlFile = substr($filename, 0, -4) . '/plugin.xml';
		if (file_exists($xmlFile))
		{
			return self::loadFromXmlFile($xmlFile);
		}
		else
		{
			return self::loadFromPhpFile($filename);
		}
	}