src/objects/scanners/Scanner.php
protected function addController($abspath, $route)
		{
			// variables
			$name           = pathinfo($abspath, PATHINFO_FILENAME);
			$segment        = preg_replace('/Controller$/', '', $name);
			$route          = strtolower($this->route . $route . $segment);

			// objects
			$instance       = Controller::fromPath($abspath, $route);

			// add
			if($instance instanceof Controller)
			{
				// controller isn't abstract, has methods, isn't private
				if ($instance->isValid())
				{
					$ref = $instance->getReference();
					$this->addRoute($route, $ref);
					return $instance;
				}
			}

			else
			{
				$ref = $instance->getReference();
				$this->addRoute($route, $ref);
				return $instance;
			}
		}
protected function addController($abspath, $route)
		{
			// variables
			$name           = pathinfo($abspath, PATHINFO_FILENAME);
			$segment        = preg_replace('/Controller$/', '', $name);
			$route          = strtolower($this->route . $route . $segment);

			// objects
			$instance       = Controller::fromPath($abspath, $route);

			// add
			if($instance instanceof Controller)
			{
				// controller isn't abstract, has methods, isn't private
				if ($instance->isValid())
				{
					$ref = $instance->getReference();
					$this->addRoute($route, $ref);
					return $instance;
				}
			}

			else
			{
				$ref = $instance->getReference();
				$this->addRoute($route, $ref);
				return $instance;
			}
		}
protected function addController ( $ abspath , $ route ) { // variables $ name = pathinfo ( $ abspath , PATHINFO_FILENAME ) ; $ segment = preg_replace ( '/Controller$/' , '' , $ name ) ; $ route = strtolower ( $ this -> route . $ route . $ segment ) ; // objects $ instance = Controller :: fromPath ( $ abspath , $ route ) ; // add if ( $ instance instanceof Controller ) { // controller isn't abstract, has methods, isn't private if ( $ instance -> isValid ( ) ) { $ ref = $ instance -> getReference ( ) ; $ this -> addRoute ( $ route , $ ref ) ; return $ instance ; } } else { $ ref = $ instance -> getReference ( ) ; $ this -> addRoute ( $ route , $ ref ) ; return $ instance ; } }
Adds a controller to the internal routes array

@param   string       $abspath
@param   string       $route
@return  Controller|\davestewart\sketchpad\objects\reflection\ControllerError
Adds a controller to the internal routes array