PHP code example of thuata / intercessionbundle

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

    

thuata / intercessionbundle example snippets



// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new Thuata\IntercessionBundle\ThuataIntercessionBundle,
        );

        // ...
    }

    // ...
}


        $class = new IntercessionClass(); // instanciates the intercession class

        $class->setName('Foo'); // sets the class name ...
        $class->setNamespace('Bar/Baz'); // ... and the namespace
        $class->addAuthor('Anthony Maudry', '[email protected]'); // the author (appears in phpdoc)
        $class->setDescription('The marvelous Foo class !'); // and a description (php doc too)
        $class->addInterface('\Bar\FooBarInterface'); // First interface to implement
        $class->addInterface('\Bar\BarFooInterface'); // and the second interface
        $class->addTrait('\Bar\FooBarTrait'); // one trait
        $class->addTrait('\Bar\BarFooTrait'); // another trait
        $class->setExtends('\Bar\AbstractFooBar'); // Foo class now extends another class
        
        /** @var GeneratorService $generator */
        $generator = $container->get('thuata_intercession.generator'); // get the generator from the conatainer
        // get the definition as string ...
        $definition = $generator->renderClass($class);
        // or write it directly in a file
        $fileName = '/some/path/to/a/file.php';
        $generator->createClassDefinitionFile($class, $fileName);
        
        // you can now