How to use getController method of directory class

Best Atoum code snippet using directory.getController

controller.php

Source:controller.php Github

copy

Full Screen

...43 {44 $controller = false;45 if (parent::getApiVersion()) {46 if (parent::getParameter()->getValue('USE_OWN_CONTROLLERS') == 'Y') {47 $path = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . parent::getParameter()->getValue('OWN_CONTROLLERS_PATH') . DIRECTORY_SEPARATOR . parent::getApiVersion() . DIRECTORY_SEPARATOR . strtolower(parent::getController()) . '.php';48 if (!file_exists($path)) {49 Response::BadRequest(Loc::getMessage('CLASS_NOT_FOUND', ['#OBJECT#' => ucfirst(parent::getController())]));50 } else {51 require_once $path;52 $controller = '\\' . str_replace(DIRECTORY_SEPARATOR, '\\', parent::getParameter()->getValue('OWN_CONTROLLERS_PATH')) . '\\' . parent::getApiVersion() . '\\' . ucfirst(strtolower(parent::getController()));53 }54 } else {55 if (!file_exists(__DIR__ . DIRECTORY_SEPARATOR . self::ROOT_DIR_CONTROLLERS . DIRECTORY_SEPARATOR . parent::getApiVersion() . DIRECTORY_SEPARATOR . strtolower(parent::getController()) . '.php')) {56 Response::BadRequest(Loc::getMessage('CLASS_NOT_FOUND', ['#OBJECT#' => ucfirst(parent::getController())]));57 } else {58 $controller = __NAMESPACE__ . '\\' . self::ROOT_DIR_CONTROLLERS . '\\' . parent::getApiVersion() . '\\' . ucfirst(strtolower(parent::getController()));59 }60 }61 } else {62 if (parent::getParameter()->getValue('USE_OWN_CONTROLLERS') == 'Y') {63 $path = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . parent::getParameter()->getValue('OWN_CONTROLLERS_PATH') . DIRECTORY_SEPARATOR . strtolower(parent::getController()) . '.php';64 if (!file_exists($path)) {65 Response::BadRequest(Loc::getMessage('CLASS_NOT_FOUND', ['#OBJECT#' => ucfirst(parent::getController())]));66 } else {67 require_once $path;68 $controller = '\\' . str_replace(DIRECTORY_SEPARATOR, '\\', parent::getParameter()->getValue('OWN_CONTROLLERS_PATH')) . '\\' . ucfirst(strtolower(parent::getController()));69 }70 } else {71 if (!file_exists(__DIR__ . DIRECTORY_SEPARATOR . self::ROOT_DIR_CONTROLLERS . DIRECTORY_SEPARATOR . strtolower(parent::getController()) . '.php')) {72 Response::BadRequest(Loc::getMessage('CLASS_NOT_FOUND', ['#OBJECT#' => ucfirst(parent::getController())]));73 } else {74 $controller = __NAMESPACE__ . '\\' . self::ROOT_DIR_CONTROLLERS . '\\' . ucfirst(strtolower(parent::getController()));75 }76 }77 }78 $controllerObject = new $controller();79 if (method_exists($controllerObject, parent::getAction())) {80 $this->log();81 $action = parent::getAction();82 $controllerObject->$action();83 } else {84 Response::BadRequest(Loc::getMessage('METHOD_NOT_FOUND', ['#OBJECT#' => ucfirst(parent::getController()), '#METHOD#' => parent::getAction()]));85 }86 }87 // Start combined mode88 private function startCombined()89 {90 $controllerObject = false;91 if (parent::getApiVersion()) {92 $file = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . parent::getApiPath() . DIRECTORY_SEPARATOR . parent::getApiVersion() . DIRECTORY_SEPARATOR . parent::getController() . DIRECTORY_SEPARATOR . parent::getAction() . '.php';93 if (parent::getParameter()->getValue('USE_OWN_CONTROLLERS') == 'Y') {94 $path = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . parent::getParameter()->getValue('OWN_CONTROLLERS_PATH') . DIRECTORY_SEPARATOR . parent::getApiVersion() . DIRECTORY_SEPARATOR . strtolower(parent::getController()) . '.php';95 if (!file_exists($path)) {96 if (!file_exists($file)) {97 Response::BadRequest(Loc::getMessage('CLASS_NOT_FOUND', ['#OBJECT#' => ucfirst(parent::getController())]));98 }99 } else {100 require_once $path;101 $controller = '\\' . str_replace(DIRECTORY_SEPARATOR, '\\', parent::getParameter()->getValue('OWN_CONTROLLERS_PATH')) . '\\' . parent::getApiVersion() . '\\' . ucfirst(strtolower(parent::getController()));102 $controllerObject = new $controller();103 }104 } else {105 if (!file_exists(__DIR__ . DIRECTORY_SEPARATOR . self::ROOT_DIR_CONTROLLERS . DIRECTORY_SEPARATOR . parent::getApiVersion() . DIRECTORY_SEPARATOR . strtolower(parent::getController()) . '.php')) {106 if (!file_exists($file)) {107 Response::BadRequest(Loc::getMessage('CLASS_NOT_FOUND', ['#OBJECT#' => ucfirst(parent::getController())]));108 }109 } else {110 $controller = __NAMESPACE__ . '\\' . self::ROOT_DIR_CONTROLLERS . '\\' . parent::getApiVersion() . '\\' . ucfirst(strtolower(parent::getController()));111 $controllerObject = new $controller();112 }113 }114 } else {115 $file = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . parent::getApiPath() . DIRECTORY_SEPARATOR . parent::getController() . DIRECTORY_SEPARATOR . parent::getAction() . '.php';116 if (parent::getParameter()->getValue('USE_OWN_CONTROLLERS') == 'Y') {117 $path = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . parent::getParameter()->getValue('OWN_CONTROLLERS_PATH') . DIRECTORY_SEPARATOR . strtolower(parent::getController()) . '.php';118 if (!file_exists($path)) {119 if (!file_exists($file)) {120 Response::BadRequest(Loc::getMessage('CLASS_NOT_FOUND', ['#OBJECT#' => ucfirst(parent::getController())]));121 }122 } else {123 require_once $path;124 $controller = '\\' . str_replace(DIRECTORY_SEPARATOR, '\\', parent::getParameter()->getValue('OWN_CONTROLLERS_PATH')) . '\\' . ucfirst(strtolower(parent::getController()));125 $controllerObject = new $controller();126 }127 } else {128 if (!file_exists(__DIR__ . DIRECTORY_SEPARATOR . self::ROOT_DIR_CONTROLLERS . DIRECTORY_SEPARATOR . strtolower(parent::getController()) . '.php')) {129 if (!file_exists($file)) {130 Response::BadRequest(Loc::getMessage('CLASS_NOT_FOUND', ['#OBJECT#' => ucfirst(parent::getController())]));131 }132 } else {133 $controller = __NAMESPACE__ . '\\' . self::ROOT_DIR_CONTROLLERS . '\\' . ucfirst(strtolower(parent::getController()));134 $controllerObject = new $controller();135 }136 }137 }138 if (is_object($controllerObject) && method_exists($controllerObject, parent::getAction())) {139 $this->log();140 $action = parent::getAction();141 $controllerObject->$action();142 } elseif ($file) {143 $this->log();144 require_once $file;145 } else {146 Response::BadRequest(Loc::getMessage('METHOD_NOT_FOUND', ['#OBJECT#' => ucfirst(parent::getController()), '#METHOD#' => parent::getAction()]));147 }148 }149 // Start file150 private function startFile()151 {152 // Get path and version controller153 if (parent::getApiVersion()) {154 $path = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . parent::getApiPath() . DIRECTORY_SEPARATOR . parent::getApiVersion() . DIRECTORY_SEPARATOR . parent::getController() . DIRECTORY_SEPARATOR . parent::getAction() . '.php';155 if (!file_exists($path)) {156 Response::BadRequest(Loc::getMessage('CLASS_NOT_FOUND', ['#OBJECT#' => ucfirst(parent::getController())]) . ' [' . parent::getApiVersion() . ']');157 }158 } else {159 $path = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . parent::getApiPath() . DIRECTORY_SEPARATOR . parent::getController() . DIRECTORY_SEPARATOR . parent::getAction() . '.php';160 if (!file_exists($path)) {161 Response::BadRequest(Loc::getMessage('CLASS_NOT_FOUND', ['#OBJECT#' => ucfirst(parent::getController())]));162 }163 }164 if (file_exists($path)) {165 // Request to log166 $this->log();167 // Start controller168 require_once $path;169 } else {170 Response::BadRequest(Loc::getMessage('METHOD_NOT_FOUND', ['#OBJECT#' => ucfirst(parent::getController()), '#METHOD#' => parent::getAction()]));171 }172 }173 // Add request to log174 private function log()175 {176 if (parent::getParameter()->getValue('SUPPORT_USE_LOG') == 'Y') {177 \Bitrix\Main\Diag\Debug::writeToFile(Request::get(), '', str_replace('.', '-' . date('Y-m-d') . '.', parent::getParameter()->getValue('SUPPORT_LOG_PATH')));178 }179 }180}...

Full Screen

Full Screen

getController

Using AI Code Generation

copy

Full Screen

1$dir = new Directory('1.php');2$dir->getController();3$dir = new Directory('1/2.php');4$dir->getController();5$dir = new Directory('1/2/3.php');6$dir->getController();7$dir = new Directory('1/2/3/4.php');8$dir->getController();9$dir = new Directory('1/2/3/4/5.php');10$dir->getController();11$dir = new Directory('1/2/3/4/5/6.php');12$dir->getController();13$dir = new Directory('1/2/3/4/5/6/7.php');14$dir->getController();15$dir = new Directory('1/2/3/4/5/6/7/8.php');16$dir->getController();17$dir = new Directory('1/2/3/4/5/6/7/8/9.php');18$dir->getController();19$dir = new Directory('1/2/3/4/5/6/7/8/9/10.php');20$dir->getController();

Full Screen

Full Screen

getController

Using AI Code Generation

copy

Full Screen

1$dir = new Directory();2$controller = $dir->getController();3$dir = new Directory();4$controller = $dir->getController();5require_once 'directory.php';6require_once 'directory.php';

Full Screen

Full Screen

getController

Using AI Code Generation

copy

Full Screen

1$dir = new Directory();2$controller = $dir->getController();3if($controller === false){4} else {5 require_once($controller);6}7$dir = new Directory();8$controller = $dir->getController();9if($controller === false){10} else {11 require_once($controller);12}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in directory

Trigger getController code on LambdaTest Cloud Grid

Execute automation tests with getController on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful