Set the methods resource.

@param string $url
@param string $controller

@return null
356699
private function setResourceMethods($url, $controller)
    {

        //index
        $this->setIndexResource($url, '', $controller);

        $url = ($url == '/') ? '' : $url;

        $this->setIndexResource($url, '/index', $controller);

        //show
        $this->setShowResource($url, '/show/{param}', $controller);

        //add
        $this->setAddResource($url, '/add', $controller);

        //insert
        $this->setInsertResource($url, '/insert', $controller);

        //edit
        $this->setEditResource($url, '/edit/{param}', $controller);

        //update
        $this->setUpdateResource($url, '/update', $controller);
        $this->setUpdateResource($url, '/update/{param}', $controller);

        //delete
        $this->setDeleteResource($url, '/delete/{param}', $controller);
    }
973453
public function setController($controller, $name = null)
    {
        $controller = $this->app->normalizeClassName($controller, 'Controller');

        return $this->add($controller, $name);
    }
115290
public function initialize(Controller $controller) {

		parent::initialize($controller);

		$loginUrl = array(
                'plugin' => 'users',
                'controller' => 'users',
                'action' => 'login', 
                'admin' => false, 
                );
        if ( !empty( $controller->request->params['tenant'] ) ) {
            $loginUrl['action'] = 'tenant_login';
        }
        $this->loginAction = $loginUrl;
        $this->logoutRedirect = $loginUrl;
	}
413466
protected function setMetaTags(Controller $controller)
    {
        $controller->setMeta(array('charset' => 'utf-8'));
        $controller->setMeta(array('http-equiv' => 'X-UA-Compatible', 'content' => 'IE=edge'));
        $controller->setMeta(array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1'));
        $controller->setMeta(array('name' => 'author', 'content' => 'GPLCart'));
    }
631627
protected function setEditRoute($controller, $action): Controller
    {
        $callTo = Inflector::classify($controller) . '@' . $action;

        $this->routes['get'] = array_merge($this->routes['get'], [
            "/$controller/$action/{:id}/" => $callTo,
        ]);

        $this->routes['post'] = array_merge($this->routes['post'], [
            "/$controller/$action/" => $callTo,
        ]);
        
        $this->routes['post'] = array_merge($this->routes['post'], [
            "/$controller/$action/{:id}/" => $callTo,
        ]);

        return $this;
    }
1309962
public function buildResource(?string $controller = null, ?string $action = null):?string
    {
        return $controller !== null ? $controller . ($action !== null ? self::RSEP . $action : '') : null;
    }
1342100
public static function setAceScript(Controller $controller, $theme = 'chrome')
    {
        /* @var \yii\web\View $view */
        $view = $controller->getView();

        AceAsset::register($view);

        $view->registerJs(
            "$('textarea[data-editor]').each(function(index, element) {
                var textarea = $(this);

                var editDiv = $('<div>', {
                    width: textarea.width(),
                    height: textarea.height(),
                    class: textarea.attr('class')
                }).insertBefore(textarea);

                textarea.addClass('hidden');

                var editor = ace.edit(editDiv[0]);
                var mode = (textarea.data('editor')).trim();
                var theme = ('{$theme}').trim();
                editor.setReadOnly(textarea.data('read-only'));
                editor.getSession().setValue(textarea.val());
                if (mode.length !== 0) {
                    editor.getSession().setMode('ace/mode/' + mode);
                }
                if (theme.length !== 0) {
                    editor.setTheme('ace/theme/' + theme);
                }

                editor.getSession().on('change', function() {
                    textarea.val(editor.getSession().getValue());
                });
            });"
        );
    }
535339
public static function execute($controller, $request) {   
        switch($request->method()) { 
            case 'POST':
                $data = $controller->store($request->bodyRequest());
                KernelHttp::makeResponse('201', $data);
                break;
            case 'PUT':
                $data = $controller->update($request->bodyRequest());
                KernelHttp::makeResponse('200', $data);
                break;
            case 'DELETE':
                $controller->destroy($request->getInteractionsRequest());
                KernelHttp::makeResponse('200');
                break;
            default: 
                $request->getRequiredParameter() ? $data = $controller->show($request->getInteractionsRequest()) : $data = $controller->index($request->getInteractionsRequest()); 
                KernelHttp::makeResponse('200', $data);
                break;
        } 
    }
57156
public function initialize(Controller $controller) {
		$this->_controller = $controller;
		$this->_model = $this->_controller->{$this->_controller->modelClass};
		if (!$this->_controller->Components->loaded('RequestHandler')) {
			$this->_controller->RequestHandler = $this->_controller->Components->load('RequestHandler');
			$this->_controller->RequestHandler->initialize($this->_controller);
		}

		$this->_modelConfigTheme = ClassRegistry::init('CakeTheme.ConfigTheme');
	}
351014
public function startup($controller = null)
    {
        if (!$controller) {
            $controller = new Controller(new Request());
        }
        $registry = new ComponentRegistry();
        $this->Acl = new AclComponent($registry, Configure::read('Acl'));
        $this->Aco = $this->Acl->Aco;
        $this->controller = $controller;
        $this->_buildPrefixes();
        $this->_processIgnored();
    }
396669
private function getResourceClosure($controller, $method)
    {
        if ($method == 'show' || $method == 'edit' || $method == 'delete') {
            return function ($id) use ($controller, $method) {
                return $controller::$method($id);
            };
        } elseif ($method == 'update') {
            return function ($request, $id) use ($controller, $method) {
                return $controller::$method($request, $id);
            };
        } elseif ($method == 'insert') {
            return function ($request) use ($controller, $method) {
                return $controller::$method($request);
            };
        } else {
            return function () use ($controller, $method) {
                return $controller::$method();
            };
        }
    }
523884
public function startup(Controller $controller) {
		if (!$this->_controller->ViewExtension->isHtml()) {
			return;
		}

		$this->_setConfigVar($controller);
	}
242883
public function initCron($src, $controller, $action) {
        if (!Config::config()['user']['debug']['maintenance']) {
            $this->_routeCron($src, $controller, $action);

            if ($this->_route == true) {
                $this->_setFunction($this->request->src);
                $this->_setEvent($this->request->src);
            }
        }
    }
1016771
public function setMethod($method = null)
    {
        if ($method === null) {
            $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : null;
        }

        $this->method = $method;
    }
569770
public function setController($controller)
        {
            if (null !== $controller && !is_string($controller)) {
                throw new Exception(
                    'Invalid argument: $controller must be a string or null'
                );
            }

            $this->_controller = $controller;
            $this->_hrefCache  = null;

            return $this;
        }
1204205
public function setViewController($controller)
    {
        if (is_scalar($controller) || is_resource($controller)) {
            throw new InvalidArgumentException(
                'View controller must be an object, null or an array'
            );
        }

        $this->viewController = $controller;

        return $this;
    }
496061
public function initialize(Controller $controller) {
		if ($this->settings['isTest']) {
			return;
		}

		$this->user = $this->Session->read("{$this->settings['path']}");

		$this->routes = Permit::$routes;
		Permit::$user = $this->user;

		$this->request = $controller->request;

		foreach (array('controller', 'plugin') as $inflected) {
			if (isset($this->request->params[$inflected])) {
				$this->request->params[$inflected] = strtolower(Inflector::underscore($this->request->params[$inflected]));
			}
		}
	}