public function getContent(AppInterface $app)
    {
        $imports = [];

        $stringedOperations = [];

        foreach ($this->migration->getOperations() as $op) {
            list($opString, $importString) = FormatFileContent::formatObject($op);

            array_push($stringedOperations, $opString);

            $imports = array_merge($imports, $importString);
        }

        $imports = array_unique($imports);

        $importPaths = '';

        foreach ($imports as $import) {
            $import = sprintf('use %s;', $import);
            $importPaths .= $import.PHP_EOL;
        }

        $opContent = '['.PHP_EOL;
        foreach ($stringedOperations as $op) {
            $opContent .= sprintf("\t\t\t%s,".PHP_EOL, $op);
        }
        $opContent .= "\t\t]";

        $dependencies = $this->migration->getDependency();

        $namespace = $this->migration->getNamespace($app);

        return sprintf(
            $this->getFileTemplate(),
            $namespace,
            $importPaths,
            $this->migration->getName(),
            "\n".rtrim(
                Tools::stringify(
                    $dependencies,
                    3,
                    0,
                    true,
                    false
                ),
                PHP_EOL
            ),
            $opContent
        );
    }
public function getContent(AppInterface $app)
    {
        $imports = [];

        $stringedOperations = [];

        foreach ($this->migration->getOperations() as $op) {
            list($opString, $importString) = FormatFileContent::formatObject($op);

            array_push($stringedOperations, $opString);

            $imports = array_merge($imports, $importString);
        }

        $imports = array_unique($imports);

        $importPaths = '';

        foreach ($imports as $import) {
            $import = sprintf('use %s;', $import);
            $importPaths .= $import.PHP_EOL;
        }

        $opContent = '['.PHP_EOL;
        foreach ($stringedOperations as $op) {
            $opContent .= sprintf("\t\t\t%s,".PHP_EOL, $op);
        }
        $opContent .= "\t\t]";

        $dependencies = $this->migration->getDependency();

        $namespace = $this->migration->getNamespace($app);

        return sprintf(
            $this->getFileTemplate(),
            $namespace,
            $importPaths,
            $this->migration->getName(),
            "\n".rtrim(
                Tools::stringify(
                    $dependencies,
                    3,
                    0,
                    true,
                    false
                ),
                PHP_EOL
            ),
            $opContent
        );
    }
public function getContent ( AppInterface $ app ) { $ imports = [ ] ; $ stringedOperations = [ ] ; foreach ( $ this -> migration -> getOperations ( ) as $ op ) { list ( $ opString , $ importString ) = FormatFileContent :: formatObject ( $ op ) ; array_push ( $ stringedOperations , $ opString ) ; $ imports = array_merge ( $ imports , $ importString ) ; } $ imports = array_unique ( $ imports ) ; $ importPaths = '' ; foreach ( $ imports as $ import ) { $ import = sprintf ( 'use %s;' , $ import ) ; $ importPaths .= $ import . PHP_EOL ; } $ opContent = '[' . PHP_EOL ; foreach ( $ stringedOperations as $ op ) { $ opContent .= sprintf ( "\t\t\t%s," . PHP_EOL , $ op ) ; } $ opContent .= "\t\t]" ; $ dependencies = $ this -> migration -> getDependency ( ) ; $ namespace = $ this -> migration -> getNamespace ( $ app ) ; return sprintf ( $ this -> getFileTemplate ( ) , $ namespace , $ importPaths , $ this -> migration -> getName ( ) , "\n" . rtrim ( Tools :: stringify ( $ dependencies , 3 , 0 , true , false ) , PHP_EOL ) , $ opContent ) ; }
Converts migration object into a string and adds it to the migration file template, ready to be written on disk.

@return string

@since  1.1.0

@author Eddilbert Macharia (http://eddmash.com) <edd.cowan@gmail.com>
Converts migration object into a string and adds it to the migration file template ready to be written on disk .