PHP code example of kzykhys / php-class-generator

1. Go to this page and download the library: Download kzykhys/php-class-generator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kzykhys / php-class-generator example snippets


$ php php-pcg.phar --from ./doc --to ./src
 php


namespace KzykHys\ClassGenerator;

/**
 * The sample of PHP Class Generator
 * Generates PHP classes from plain text document (*.pcg)
 */
class Sample extends Container implements \IteratorAggrigate, \Countable {

    /**
     * @var \ArrayIterator $iterator
     */
    public $iterator;

    /**
     * @var array $container
     */
    protected $container;

    /**
     * The length of code
     * 
     * @var integer $length
     */
    protected $length;

    /**
     * Whether this class is compiled or not
     * 
     * @var boolean $compiled
     */
    protected $compiled;

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

    /**
     * @var Generator $generator
     */
    private $generator;


    /**
     * @param array $options
     */
    public function __construct(array $options)
    {
        
    }

    /**
     * @param string $document
     * @param string $version
     *
     * @return \KzykHys\ClassGenerator\Compiler\StreamWriter
     */
    public function generate($document, $version)
    {
        
    }

    /**
     * Returns the code as a string
     * 
     *
     * @return string
     */
    public function getString()
    {
        
    }

    /**
     * Write the code to file
     * 
     * @param string $filename
     */
    public function write($filename)
    {
        
    }

    /**
     *
     * @return integer
     */
    public function count()
    {
        
    }

    /**
     *
     * @return Container
     */
    protected function traverseContainer()
    {
        
    }

}

php-cg build

  [UnexpectedValueException]
  creating archive "php-cg.phar" disabled by the php.ini setting phar.readonly

php -d phar.readonly=0 php-cg build