Create Stub File

@param $configuration
972525
public function createStubFiles($configuration)
    {
        $stubPathLocation = $this->path . '/' . data_get($configuration, 'path', $configuration);
        $this->generateStubFile($stubPathLocation, $this->resourceName, $configuration);
        $this->comment("Successfully Create ".$this->resourceName." Resource");
        $this->comment("Path Location ".$stubPathLocation);
        $this->output->writeln('');
    }
1326862
public static function create(Loader $configuration = null, EngineFactory $engineFactory = null)
    {
        return new self($configuration, $engineFactory);
    }
82559
public function init(?string $configuration = 'stylesheets'): void
    {
        $config = Core::i()->config->getConfiguration($configuration);
        foreach ($config as $script) {
            $this->append($script);
        }
    }
1222181
public function initConfiguration(Configuration $configuration = null)
    {
        if (isset($configuration)) {
            $this->configuration = $configuration;
        }

        if (isset($this->configuration)) {
            $this->setLogger($this->configuration->getLogger());
            $this->componentFactory = null;
            $this->prepareFactory();
        }
    }
67635
public static function create(array $configuration)
    {
        $currentConfiguration = is_array($configuration) ? array_merge(self::$defaultConfiguration, $configuration)
            : self::$defaultConfiguration;

        $class = self::className($currentConfiguration);

        $adapter = new $class($currentConfiguration[Config::PARAMS]);

        return new Storage($adapter);
    }
222811
public function init($configuration)
    {
        $returnValue = (bool) false;

        
    	if (isset($configuration['file'])) {
    		$this->filename = $configuration['file'];
    		$returnValue = parent::init($configuration);
    	} else {
    		$returnValue = false;
    	}
        

        return (bool) $returnValue;
    }
218289
protected function loadConfigurationFile(array $configuration, SplFileInfo $file, $key = null)
    {
        $pathname = $file->getPathname();
        $contents = $this->loader->load($pathname);
        $contents = mb_strpos($key, 'plugins') === false ? $this->wrapConfigurationContents($file, $contents) : $contents;
        if (!is_array($contents)) {
            return $configuration;
        }

        // Since non-PHP files don't support closures
        // unset them to pass configuration validation
        if ($file->getExtension() !== 'php') {
            unset($contents['config']['logs'], $contents['remote']['permissions']['callback']);
        }

        // Append configuration to the queue
        $configuration[$pathname] = [];
        Arr::set($configuration[$pathname], $key, $contents);

        return $configuration;
    }
904148
public function compile($stub, $modelName, $modelData, stdClass $scaffolderConfig, $hash, array $extensions, $extra = null)
    {
        $this->stub = $stub;

        $this->replaceResource($modelName);

        return $this->stub;
    }
80945
public function setNewDatabase($configuration): void
    {
        if ($configuration instanceof Configurator) {
            $this->db = new Db($configuration);
        } else {
            $this->db = new Db(new Configurator($configuration));
        }
    }
942825
protected function addBackups(Configuration $configuration, array $laravelPhpbu)
    {
        // walk the the configured backups
        foreach (array_keys($this->types) as $type) {
            foreach ($laravelPhpbu[$type] as $conf) {
                // create and add a phpbu backup config
                $configuration->addBackup($this->translateBackup($type, $conf));
            }
        }
    }
262037
public static function createByConfiguration($modeName, array $configuration)
    {
        $mode = new static();
        $mode->setName($modeName);
        $mode->setPreview($configuration['isPreviewMode']);
        $mode->setEdit($configuration['isEditingMode']);
        $mode->setTitle($configuration['title']);

        if (isset($configuration['fusionRenderingPath'])) {
            $mode->setFusionPath($configuration['fusionRenderingPath']);
        } else {
            $mode->setFusionPath('');
        }

        if (isset($configuration['options']) && is_array($configuration['options'])) {
            $mode->setOptions($configuration['options']);
        }

        return $mode;
    }
660683
public function createFileFromTemplate(array $configuration)
    {
        $destination = $configuration['destination'];
        $templateDestination = $configuration['templateDestination'];

        if( $destination[0] == '/' )
            $preserveSlash = '/';
        else
            $preserveSlash = '';

        if( ! isset($destination) )
            $this->error('File creation failed, destination not set');

        if( ! isset($templateDestination) )
            $this->error('File creation failed, template destination not set');

        $destination = str_replace('\\', '/', $destination);

        $template = file_get_contents($templateDestination);

        if( isset($configuration['content']) )
            $template = replaceBrackets($template, $configuration['content']);

        $directory = array_filter(explode('/', $destination));
        array_pop($directory);
        $directory = $preserveSlash . implode('/', $directory);

        $this->createDirectory($directory);
        file_put_contents($destination, $template);

        $this->info('Created: ' . $destination);
    }
238388
protected static function loadAdditionalConfiguration(Configuration $configuration)
    {
        if (null !== ($pattern = $configuration->getAdditionalConfigurationDirectory())) {
            $iterator = new \DirectoryIterator(sprintf($pattern, dirname($configuration->getIdentity())));
            foreach ($iterator as $file) {
                $configuration->merge(Configuration::createFromFile($file->getRealPath()));
            }
        }
    }
71130
public static function makeDB(\Native5\Core\Database\DBConfig $configuration)
    {
        if (empty($configuration))
            throw new \Exception('Empty connection settings provided'); 

        $port = $configuration->getPort();
        $port = !empty($port) ? $port : 3306;
        $dsn = $configuration->getType().':host='.$configuration->getHost().';port='.$port.';dbname='.$configuration->getName();
        $dbKey = md5($dsn.'.'.$configuration->getUser());

        if (isset(self::$_dbs[$dbKey]) && !empty(self::$_dbs[$dbKey]) && self::$_dbs[$dbKey]->checkConnection())
            return self::$_dbs[$dbKey];

        // Create a DB Instance for this user + database combination
        return (self::$_dbs[$dbKey] = new \Native5\Core\Database\DB($configuration));
    }
1031481
public function createStubs()
    {
        foreach ($this->options() as $stubKey => $fileName) {
            if(!blank($fileName) && $fileName) {
                $this->resourceName = $fileName;
                $this->stubKey = $stubKey;
                if($stubKey == 'key') {
                    $this->stubKey = $fileName;
                    $this->resourceName = strtolower($this->ask('Enter your file name'));
                }
                $configuration = $this->config->get('tie.stubs.structure.' . $this->stubKey);
                $this->createStubFiles($configuration);
            }
        }
    }
1293739
protected function generateClass($dir, $stub, array $arguments = [])
    {
        $this->line($this->colorize('Crafting:')." Generating [{$this->getClassname()}] class...");

        $base = $this->config->get('app.directory');
        $file = "{$base}/app/{$dir}/{$this->getClassname()}.php";

        if ($this->filesystem->exists($file)) {
            $this->confirm("[{$this->getClassname()}] class already exists. Want to overwrite?");
        }

        $template = $this->filesystem->get(__DIR__."/stubs/{$stub}");

        $this->filesystem->put($file, $this->stub->render($template, $arguments));

        $this->success("{$this->getClassname()} created successfully.");
    }
161585
public function buildJob(Configuration $configuration, array $data): Definition
    {
        try {
            $builder = $this->jobBuilders->get($data['type']);
        } catch (ServiceNotFoundException $exception) {
            throw new \RuntimeException('Unknown job type "' . $data['type'] . '"', 0, $exception);
        }
        /** @var DefinitionBuilderInterface $builder */
        return $builder->build($configuration, $data);
    }