Create resource controller if not null

@param $option
775724
private function makeResourceController($option)
    {
        if ($option) {
            $controllerName = Str::studly(class_basename($this->argument('name')));
            $controllerNameFile = $controllerName . 'Controller.php';

            try {
                $controllerPath = __DIR__ . '/controller.stub';
                $controllerAppPath = app_path('Http/Controllers/' . $controllerNameFile);

                $this->helper->replaceAndSave($controllerPath, '{{name}}', $controllerName, $controllerAppPath);
            } catch (\Exception $e) {
                return $this->error($e->getMessage());
            }
        }
    }
593390
public static function process($options = []) {
		// start buffering
		\Helper\Ob::start(true);
		$controller_class = self::$settings['mvc']['controller_class'];
		// processing options
 		if (!empty($options)) {
			foreach ($options as $k => $v) {
				self::$controller->{$k} = $v;
			}
 		}
		// put action into controller
		self::$controller->action_code = self::$settings['mvc']['controller_action_code'];
		self::$controller->action_method = self::$settings['mvc']['controller_action'];
		// check ACL
		if ($controller_class != '\Controller\Errors') {
			if (!self::$controller->permitted(['redirect' => true])) {
				Throw new \Exception('Permission denied!', -1);
			}
		}
		// auto populating input property in controller
 		if (!empty(self::$settings['application']['controller']['input'])) {
			self::$controller->input = \Request::input(null, true, true);
 		}
		// init method
		if (method_exists(self::$controller, 'init')) {
			call_user_func(array(self::$controller, 'init'));
		}
		// check if action exists
		if (!method_exists(self::$controller, self::$controller->action_method)) {
			Throw new \Exception('Action does not exists!');
		}
		// calling action
		echo call_user_func(array(self::$controller, self::$controller->action_method));
		// auto rendering view only if view exists, processing extension order as specified in .ini file
		$temp_reflection_obj = new ReflectionClass(self::$controller);
		$controller_dir = pathinfo($temp_reflection_obj->getFileName(), PATHINFO_DIRNAME) . '/';
		$controller_file = end(self::$settings['mvc']['controllers']);
		$view = self::$settings['mvc']['controller_view'];
		$flag_view_found = false;
		if (!empty($view)) {
			$extensions = explode(',', isset(self::$settings['application']['view']['extension']) ? self::$settings['application']['view']['extension'] : 'html');
			foreach ($extensions as $extension) {
				$file = $controller_dir  . $controller_file . '.' . $view . '.' . $extension;
				if (file_exists($file)) {
					$view_object = new \View(self::$controller, $file, $extension);
					$flag_view_found = true;
					break;
				}
			}
			// if views are mandatory
			if (!empty(self::$settings['application']['view']['mandatory']) && !$flag_view_found) {
				Throw new \Exception('View ' . $view . ' does not exists!');
			}
		}
		// autoloading media files
		\Layout::includeMedia($controller_dir, $controller_file, $view, $controller_class);
		// appending view after controllers output
		self::$controller->data->view = (self::$controller->data->view ?? '') . \Helper\Ob::clean();
		// if we have to render debug toolbar
		if (\Debug::$toolbar) {
			\Helper\Ob::start();
		}
		// call pre rendering method in bootstrap
		\Bootstrap::preRender();
		// rendering layout
		$__skip_layout = self::get('flag.global.__skip_layout');
		if (!empty(self::$settings['mvc']['controller_layout']) && empty($__skip_layout)) {
			\Helper\Ob::start();
			if (file_exists(self::$settings['mvc']['controller_layout_file'])) {
				$layout_object = new \Layout(self::$controller, self::$settings['mvc']['controller_layout_file'], self::$settings['mvc']['controller_layout_extension']);
			}
			// session expiry dialog before replaces
			\Session::expiryDialog();
			// buffer output and handling javascript files, chicken and egg problem
			$from = [
				'<!-- [numbers: messages] -->',
				'<!-- [numbers: title] -->',
				'<!-- [numbers: document title] -->',
				'<!-- [numbers: actions] -->',
				'<!-- [numbers: breadcrumbs] -->',
				'<!-- [numbers: javascript links] -->',
				'<!-- [numbers: javascript data] -->',
				'<!-- [numbers: css links] -->',
				'<!-- [numbers: layout onload] -->',
				'<!-- [numbers: layout onhtml] -->',
				'<!-- [numbers: workflows] -->'
			];
			$to = [
				\Layout::renderMessages(),
				\Layout::renderTitle(),
				\Layout::renderDocumentTitle(),
				\Layout::renderActions(),
				\Layout::renderBreadcrumbs(),
				\Layout::renderJs(),
				\Layout::renderJsData(),
				\Layout::renderCss(),
				\Layout::renderOnload(),
				\Layout::$onhtml,
				\Object\Form\Workflow\Base::render()
			];
			echo str_replace($from, $to, \Helper\Ob::clean());
		} else {
			echo self::$controller->view;
		}
		// headers
		if (!empty(self::$settings['header']) && !headers_sent()) {
			foreach (self::$settings['header'] as $k => $v) {
				header($v);
			}
		}
		// ajax calls that has not been processed by application
		if (self::get('flag.global.__ajax')) {
			\Layout::renderAs(['success' => false, 'error' => [\I18n(null, 'Could not process ajax call!')]], 'application/json');
		}
	}
1264459
protected function createForm($options = null)
    {
        $form = parent::createForm($options);

        $form->activateJQuery();

        return $form;
    }
1222535
public static function enable($option) {

		if(false === is_int($option)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($option)), E_USER_ERROR);
		}
		
		static :: $options[$option] = true;
	}
720989
public function setOption($option, $value = null)
    {
        if (is_array($option)) { // If it's an array, loop through each option and call this method recursively.
            foreach ($option as $opt => $val) {
                $this->setOption($opt, $val);
            }
            return;
        }

        if (array_key_exists($option, $this->defaults)) { // If it is a default value.
            throw new ProtectedOptionException(sprintf('Unable to set protected option #%u', $option));
        }

        if (curl_setopt($this->handle, $option, $value) === false) {
            throw new CurlErrorException(sprintf('Couldn\'t set option #%u', $option));
        }
    }
512576
protected function setResourceCreate($name, $controller, $action, $options = [])
    {
        return $this->mapResource('post', $name, $controller, 'post' . ucfirst($action));
    }
873822
def resources_controller(**options)
      ResourcesController.inject(self, **options)

      self.after_save_action = options[:after_save_action] || after_save_action

      resource_belongs_to(*options[:belongs_to]) if options[:belongs_to]
      if options[:source_relation]
        protected define_method(:source_relation, &options[:source_relation])
      end
    end
183262
protected function setResourceShow($name, $controller, $action, $options = [])
    {
        return $this->mapResource('get', $name . '/(\d+)', $controller, 'get' . ucfirst($action), true);
    }
174566
public function router($resource, $arguments)
	{
		// if this is an ajax call
		if ($this->is_restful())
		{
			// have the Controller_Rest router deal with it
			return parent::router($resource, $arguments);
		}

		// check if a input specific method exists
		$controller_method = strtolower(\Input::method()) . '_' . $resource;

		// fall back to action_ if no rest method is provided
		if ( ! method_exists($this, $controller_method))
		{
			$controller_method = 'action_'.$resource;
		}

		// check if the action method exists
		if (method_exists($this, $controller_method))
		{
			return call_fuel_func_array(array($this, $controller_method), $arguments);
		}

		// if not, we got ourselfs a genuine 404!
		throw new \HttpNotFoundException();
	}
607010
public function loadTask(Option $option)
    {
        $databases = $this->getDatabases($option);

        $start = microtime(true);
        foreach ($databases as $alias => $database) {
            $manager = $this->getManager($alias, $database);

            $schemaFile = $this->migrationHelper->getSchemaFile($alias);
            $this->console->log($schemaFile);
            
            try {
                $this->sendMessage('schema loading... -> %s', $schemaFile);
                $manager->loadSchema($this->application->getEnv(), $schemaFile);
            } catch (\Exception $e) {
                $this->sendMessage($e->getMessage());
                $this->sendMessage('has error. aborting.');
                return;
            }
        }
        $end = microtime(true);

        $this->sendMessage('');
        $this->sendMessage('All Done. Took %.4fs', $end - $start);
    }
1350217
public function option(string $option, ?string $value = null): ProcessBuilder
    {
        if ($option === '') {
            return $this;
        }

        if (strpos($option, '-') !== 0) {
            $option = sprintf('--%s', $option);
        }

        $this->arguments[] = $option;

        if ($value !== null) {
            $this->arguments[] = $value;
        }

        return $this;
    }
140055
protected function fillOptions($options): void
    {
        $this->uri = $options['uri'] ?? '/';
        $this->namespace = $options['namespace'] ?? config('jsonrpc.controllerNamespace', 'App\\Http\\Controllers\\Api\\');
        $this->postfix = $options['postfix'] ?? config('jsonrpc.controllerPostfix', 'Controller');
        $this->description = $options['description'] ?? config('jsonrpc.description', 'JsonRpc Server');
        $this->controller = $options['controller'] ?? config('jsonrpc.defaultController', 'Api');
        $this->middleware = $options['middleware'] ?? config('jsonrpc.middleware', [MethodClosureMiddleware::class]);
        $this->acl = $options['acl'] ?? config('jsonrpc.acl', []);
        $this->auth = $options['auth'] ?? config('jsonrpc.authValidate', true);
        $this->handlers = $options['handlers'] ?? config('jsonrpc.handlers', self::DEFAULT_HANDLERS);
        $this->endpoint = $options['endpoint'] ?? null;
        $this->action = $options['action'] ?? null;
    }
410421
public function lselectLocalizedOptionWithJavascript($selector, $option) {
        $localizedOption = $this->localizeTarget($option);
        $this->selectOptionWithJavascript($selector, $localizedOption);
    }
469020
public function seederTask(Option $option)
    {
        $database = $option->get('database');
        $current = $this->getCurrentAppDir($option);
        $seeder_dir = $this->loader->find($current . DS . $this->application->config('directory.database.seed'))->first();
        $seeder_dir->absolutize();

        foreach ($option->getArgs() as $arg) {
            $name = $this->migrationHelper->seederNameStrategy($arg);
            $filename = $this->migrationHelper->seederFileNameStrategy($database, $name);
            $seeder_file = $this->loader->findFirst($seeder_dir . DS . $filename, true);
            $classname = $seeder_file->getClassName(false);
            $namespace = $seeder_file->getNameSpace();

            $skeleton = $this->getSkeleton('Seeder');

            $base_dir = clone $seeder_dir;
            
            $skeleton->assign('namespace', $namespace ? $namespace : '');
            $skeleton->assign('class', $classname);
            
            $this->fileUtil->mkdirP(dirname($seeder_file));
            $this->fileUtil->putContents($seeder_file, $skeleton->render());

            $this->sendMessage('created seeder file. -> %s', $seeder_file);
        }
    }
832793
private function setOptions($options, $resource)
    {
        if (!empty($options['version']) && is_string($options['version'])) {
            $this->version = $options['version'];
        } elseif (!empty($resource[2])) {
            $this->version = $resource[2];
        }

        if (!empty($options['url']) && is_string($options['url'])) {
            $this->url = $options['url'];
        }

        if (isset($options['secured']) && is_bool($options['secured'])) {
            $this->secure = $options['secured'];
        }

        if (isset($options['call']) && is_bool($options['call'])) {
            $this->call = $options['call'];
        }
        $this->changed = true;
    }
851153
public function resource($name, $controller, array $options = array())
	{
		// If the resource name contains a slash, we will assume the developer wishes to
		// register these resource routes with a prefix so we will set that up out of
		// the box so they don't have to mess with it. Otherwise, we will continue.
		if (str_contains($name, '/'))
		{
			$this->prefixedResource($name, $controller, $options);

			return;
		}

		// We need to extract the base resource from the resource name. Nested resources
		// are supported in the framework, but we need to know what name to use for a
		// place-holder on the route wildcards, which should be the base resources.
		$base = $this->getResourceWildcard(last(explode('.', $name)));

		$defaults = $this->resourceDefaults;

		foreach ($this->getResourceMethods($defaults, $options) as $m)
		{
			$this->{'addResource'.ucfirst($m)}($name, $base, $controller, $options);
		}
	}
1010302
public static function init($options) {
		self::$debug = !empty($options['debug']) ? true : false;
		if (self::$debug) {
			self::$email = !empty($options['email']) ? $options['email'] : null;
			self::$toolbar = !empty($options['toolbar']) ? true : false;
			self::benchmark('application start');
		}
	}