Call controller generator if user confirms

@param $resource
762722
protected function callController($resource)
    {
        $controllerName = $this->getControllerName($resource);

        if ($this->confirm("Do you want me to create a $controllerName controller? [yes|no]"))
        {
            $this->call('generate:controller', [
                'controllerName' => $controllerName,
                '--templatePath' => Config::get("generators::config.scaffold_controller_template_path")
            ]);
        }
    }
777059
protected function metRequirements(Resource $resource)
    {
        if (!$resource->hasFields()) {
            $this->error('You must provide at least one field to generate the views!');

            return false;
        }

        if (!$resource->hasPrimaryField()) {
            $this->error('None of the fields is set primary! You must assign on of the fields to be a primary field.');

            return false;
        }

        return true;
    }
518633
public function confirm($request, $response, $args)
    {
        $this->ci->view->render($response, 'FormGenerator/confirm.html.twig', $request->getQueryParams());
    }
1009587
protected function setupCreateReference($resource)
    {
        foreach ($resource->settings['actions']['CreateReference']['uris'] as $property => $uri) {
            $this->setupCreate($resource, $uri, $property);
        }
    }
196204
protected function matchesResource(Resource $resource = null)
    {
        // If the resource is null we should only return true if the current resource is also null.
        if ($resource === null) {
            return $this->getResource() === null || (
                $this->getResourceType() === null && $this->getResourceId() === null
            );
        }

        // If the permission's resource id is null then all resources with a specific ID are accepted.
        if ($this->getResourceId() === null) {
            return $this->getResourceType() === $resource->getResourceType();
        }

        // Otherwise make sure that we're matching a specific resource.
        return (
            $this->getResourceType() === $resource->getResourceType() &&
            $this->getResourceId() === $resource->getResourceId()
        );
    }
1284932
public function prependResource($resource) {
		$resource = $this->handleResource($resource);
		
		$this->resources->unshift($resource);
		return $resource;
	}
1129273
public function generate(Resource $resource, array $data = array()) : void
    {
        $filepath  = $resource->getSrcFilename();
        $name      = $data['name'];
        $arguments = $data['arguments'];

        $argString = $this->argumentBuilder->buildFrom($arguments);

        $values = array('%name%' => $name, '%arguments%' => $argString);
        if (!$content = $this->templates->render('method', $values)) {
            $content = $this->templates->renderString(
                $this->getTemplate(), $values
            );
        }

        $code = $this->filesystem->getFileContents($filepath);
        $code = preg_replace('/}[ \n]*$/', rtrim($content) ."\n}\n", trim($code));
        $this->filesystem->putFileContents($filepath, $code);

        $this->io->writeln(sprintf(
                "\n<info>Method <value>%s::%s()</value> has been created.</info>",
                $resource->getSrcClassname(), $name
            ), 2);
    }
744369
function registerResource( $res )
    {
        if ( is_object( $res ) )
            $this->Resources[$res->resourceName()] =& $res;
        else
            $this->warning( "registerResource()", "Supplied argument is not a resource object" );
    }
191397
private function createResourceController(
        Generator $generator,
        $prefix,
        $controller,
        $model_namespace = ''
    ) {
        $generator->write('controller/rest', [
            'modelNamespace' => $model_namespace,
            'prefix' => $prefix,
            'baseNamespace' => $this->namespaces['controller']
        ]);

        echo Color::green('The controller Rest was well created.');
    }
1115499
public function unlock($resource) {
        if ($this->hasExclusiveLock($resource)) {
            $this->exclusiveLock = null;
        }
        if ($this->hasSharedLock($resource)) {
            unset($this->sharedLock[$this->getResourceId($resource)]);
        }
    }
912483
public function detect(&$controller) {

        $this->controller = &$controller;
        $this->name = Inflector::singularize($this->controller->name);

        #set include path for IDS  and store old one
        $path = get_include_path();
        set_include_path( VENDORS . 'phpids/');

        #require the needed files
        vendor('phpids/IDS/Init');

        #add request url and user agent
        $_REQUEST['IDS_request_uri'] = $_SERVER['REQUEST_URI'];
        if (isset($_SERVER['HTTP_USER_AGENT'])) {
            $_REQUEST['IDS_user_agent'] = $_SERVER['HTTP_USER_AGENT'];
        }

        #init the PHPIDS and pass the REQUEST array
        $this->init = IDS_Init::init();
        $ids        = new IDS_Monitor($_REQUEST, $this->init);
        $result     = $ids->run();

        // Re-set include path
        set_include_path($path);

        if (!$result->isEmpty()) {
            $this->react($result);
        }

        return true;
    }
26752
public function tryResourceAssignation(DomainResource $resource)
    {
        if ($type = $this->matchType($resource)) {
            $this->resources[$type] = $resource;

            return true;
        }

        return false;
    }
916303
public function need_confirm_regrading($controller) {
        $data = $this->get_data();
        if (isset($data->rubric['regrade'])) {
            // we have already displayed the confirmation on the previous step
            return false;
        }
        if (!isset($data->saverubric) || !$data->saverubric) {
            // we only need confirmation when button 'Save rubric' is pressed
            return false;
        }
        if (!$controller->has_active_instances()) {
            // nothing to re-grade, confirmation not needed
            return false;
        }
        $changelevel = $controller->update_or_check_rubric($data);
        if ($changelevel == 0) {
            // no changes in the rubric, no confirmation needed
            return false;
        }

        // freeze form elements and pass the values in hidden fields
        // TODO MDL-29421 description_editor does not freeze the normal way, uncomment below when fixed
        $form = $this->_form;
        foreach (array('rubric', 'name'/*, 'description_editor'*/) as $fieldname) {
            $el =& $form->getElement($fieldname);
            $el->freeze();
            $el->setPersistantFreeze(true);
            if ($fieldname == 'rubric') {
                $el->add_regrade_confirmation($changelevel);
            }
        }

        // replace button text 'saverubric' and unfreeze 'Back to edit' button
        $this->findButton('saverubric')->setValue(get_string('continue'));
        $el =& $this->findButton('editrubric');
        $el->setValue(get_string('backtoediting', 'gradingform_rubric'));
        $el->unfreeze();

        return true;
    }
1005382
protected function isRequested($resource = null): bool
    {
        $requestKey = config('fractal.auto_includes.request_key');

        if (! config('fractal.auto_includes.enabled')) {
            return false;
        }

        if (! $includes = app('request')->get($requestKey)) {
            return false;
        }

        $includes = explode(',', $includes);

        if (! \is_array($includes)) {
            return false;
        }

        if (! \in_array($resource, $includes, false)) {
            return false;
        }

        return true;
    }
766816
public function setConnectionResource($resource): void
    {
        foreach ($this->items as $converter) {
            if ($converter instanceof ConnectionAware) {
                $converter->setConnectionResource($resource);
            }
        }
    }
450456
protected function resourceExists($resource)
    {
        /** @var \DreamFactory\Core\Contracts\ServiceResponseInterface $rs */
        $rs = ServiceManager::handleRequest($this->service->getName(), Verbs::GET, $resource);
        if ($rs->getStatusCode() === HttpStatusCodes::HTTP_NOT_FOUND) {
            return false;
        }

        return true;
    }
1034663
public function supports($resource, $type = null): bool
    {
        \assert('is_string($resource) && ($type === null || is_string($type))');
        return $this->parser->supports(pathinfo($resource, PATHINFO_EXTENSION));
    }