PHP code example of rollun-com / rollun-dic

1. Go to this page and download the library: Download rollun-com/rollun-dic 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/ */

    

rollun-com / rollun-dic example snippets


    class Class1
    {
        public $propA;
        public $propB;
        public $propC;

        public function __construct($propA = null, $propB = null, $propC = null)
        {
            $this->propA = $propA;
            $this->propB = $propB;
            $this->propC = $propC;
        }
    }

    /* @var $container ContainerInterface */
    global $container;
    $propA = $container->has('propA') ? $container->get('propA') : null;
    $propB = $container->has('propB') ? $container->get('propB') : null;
    $propC = $container->has('propC') ? $container->get('propC') : null;

    new Class1($propA, $propB, $propC);

	class Class1 extends Class0
	{
	    public function __construct($newPropA = null)
	    {
	          InsideConstruct::init(['newPropA' => 'propA']);  
		}
	};

	class Class1 extends Class0
	{
	    public function __construct($propB = null)
	    {
	            $params = InsideConstruct::setConstructParams();
	            $propA = ($params['propB'])->getPropA();
				InsideConstruct::runParentConstruct(['propA' => $propA]);
		}
	};