protected function processAutoInitProperties () {
		$type = new \ReflectionClass($this);
		/** @var $props \ReflectionProperty[] */
		$props = $type->getProperties(
			\ReflectionProperty::IS_PUBLIC |
			\ReflectionProperty::IS_PROTECTED |
			\ReflectionProperty::IS_PRIVATE
		);
		$toolsClass = $this->application->GetToolClass();
		foreach ($props as $prop) {
			$docComment = $prop->getDocComment();
			if (mb_strpos($docComment, '@autoinit') === FALSE) continue;
			$propName = $prop->getName();
			$methodName = 'create' . ucfirst($propName);
			$hasMethod = $type->hasMethod($methodName);
			if (!$hasMethod) {
				$methodName = '_'.$methodName;
				$hasMethod = $type->hasMethod($methodName);
			}
			if ($hasMethod) {
				$method = $type->getMethod($methodName);
				if (!$method->isPublic()) $method->setAccessible(TRUE);
				$instance = $method->invoke($this);
				$implementsController = $instance instanceof \MvcCore\IController;
			} else {
				$pos = mb_strpos($docComment, '@var ');
				if ($pos === FALSE) continue;
				$docComment = str_replace(["\r","\n","\t", "*/"], " ", mb_substr($docComment, $pos + 5));
				$pos = mb_strpos($docComment, ' ');
				if ($pos === FALSE) continue;
				$className = trim(mb_substr($docComment, 0, $pos));
				if (!@class_exists($className)) {
					$className = $prop->getDeclaringClass()->getNamespaceName() . '\\' . $className;
					if (!@class_exists($className)) continue;
				}
				$implementsController = $toolsClass::CheckClassInterface(
					$className, 'MvcCore\IController', FALSE, FALSE
				);
				if ($implementsController) {
					$instance = $className::CreateInstance();
				} else {
					$instance = new $className();
				}
			}
			if ($implementsController)
				$this->AddChildController($instance, $propName);
			if (!$prop->isPublic()) $prop->setAccessible(TRUE);
			$prop->setValue($this, $instance);
		}
	}
protected function processAutoInitProperties () {
		$type = new \ReflectionClass($this);
		/** @var $props \ReflectionProperty[] */
		$props = $type->getProperties(
			\ReflectionProperty::IS_PUBLIC |
			\ReflectionProperty::IS_PROTECTED |
			\ReflectionProperty::IS_PRIVATE
		);
		$toolsClass = $this->application->GetToolClass();
		foreach ($props as $prop) {
			$docComment = $prop->getDocComment();
			if (mb_strpos($docComment, '@autoinit') === FALSE) continue;
			$propName = $prop->getName();
			$methodName = 'create' . ucfirst($propName);
			$hasMethod = $type->hasMethod($methodName);
			if (!$hasMethod) {
				$methodName = '_'.$methodName;
				$hasMethod = $type->hasMethod($methodName);
			}
			if ($hasMethod) {
				$method = $type->getMethod($methodName);
				if (!$method->isPublic()) $method->setAccessible(TRUE);
				$instance = $method->invoke($this);
				$implementsController = $instance instanceof \MvcCore\IController;
			} else {
				$pos = mb_strpos($docComment, '@var ');
				if ($pos === FALSE) continue;
				$docComment = str_replace(["\r","\n","\t", "*/"], " ", mb_substr($docComment, $pos + 5));
				$pos = mb_strpos($docComment, ' ');
				if ($pos === FALSE) continue;
				$className = trim(mb_substr($docComment, 0, $pos));
				if (!@class_exists($className)) {
					$className = $prop->getDeclaringClass()->getNamespaceName() . '\\' . $className;
					if (!@class_exists($className)) continue;
				}
				$implementsController = $toolsClass::CheckClassInterface(
					$className, 'MvcCore\IController', FALSE, FALSE
				);
				if ($implementsController) {
					$instance = $className::CreateInstance();
				} else {
					$instance = new $className();
				}
			}
			if ($implementsController)
				$this->AddChildController($instance, $propName);
			if (!$prop->isPublic()) $prop->setAccessible(TRUE);
			$prop->setValue($this, $instance);
		}
	}
protected function processAutoInitProperties ( ) { $ type = new \ ReflectionClass ( $ this ) ; /** @var $props \ReflectionProperty[] */ $ props = $ type -> getProperties ( \ ReflectionProperty :: IS_PUBLIC | \ ReflectionProperty :: IS_PROTECTED | \ ReflectionProperty :: IS_PRIVATE ) ; $ toolsClass = $ this -> application -> GetToolClass ( ) ; foreach ( $ props as $ prop ) { $ docComment = $ prop -> getDocComment ( ) ; if ( mb_strpos ( $ docComment , '@autoinit' ) === FALSE ) continue ; $ propName = $ prop -> getName ( ) ; $ methodName = 'create' . ucfirst ( $ propName ) ; $ hasMethod = $ type -> hasMethod ( $ methodName ) ; if ( ! $ hasMethod ) { $ methodName = '_' . $ methodName ; $ hasMethod = $ type -> hasMethod ( $ methodName ) ; } if ( $ hasMethod ) { $ method = $ type -> getMethod ( $ methodName ) ; if ( ! $ method -> isPublic ( ) ) $ method -> setAccessible ( TRUE ) ; $ instance = $ method -> invoke ( $ this ) ; $ implementsController = $ instance instanceof \ MvcCore \ IController ; } else { $ pos = mb_strpos ( $ docComment , '@var ' ) ; if ( $ pos === FALSE ) continue ; $ docComment = str_replace ( [ "\r" , "\n" , "\t" , "*/" ] , " " , mb_substr ( $ docComment , $ pos + 5 ) ) ; $ pos = mb_strpos ( $ docComment , ' ' ) ; if ( $ pos === FALSE ) continue ; $ className = trim ( mb_substr ( $ docComment , 0 , $ pos ) ) ; if ( ! @ class_exists ( $ className ) ) { $ className = $ prop -> getDeclaringClass ( ) -> getNamespaceName ( ) . '\\' . $ className ; if ( ! @ class_exists ( $ className ) ) continue ; } $ implementsController = $ toolsClass :: CheckClassInterface ( $ className , 'MvcCore\IController' , FALSE , FALSE ) ; if ( $ implementsController ) { $ instance = $ className :: CreateInstance ( ) ; } else { $ instance = new $ className ( ) ; } } if ( $ implementsController ) $ this -> AddChildController ( $ instance , $ propName ) ; if ( ! $ prop -> isPublic ( ) ) $ prop -> setAccessible ( TRUE ) ; $ prop -> setValue ( $ this , $ instance ) ; } }
Initialize all members implementing `\MvcCore\IController` marked
in doc comments as `@autoinit` into `\MvcCore\Controller::$controllers` array
and into member property itself. This method is always called inside
`\MvcCore\Controller::Init();` method, after session has been started.
Create every new instance by calling existing method named as
`[_]create<PascalCasePropertyName>` and returning new instance or by doc
comment type defined by `@var` over static method `$ClassName::CreateInstance()`.
@return void
Initialize all members implementing \ MvcCore \ IController marked in doc comments as