Kecik/Kecik.php
private function createCallbackFromString( $callFunc, $params ) {

		if ( is_string( $callFunc ) ) {
			$callFunc = function () use ( $callFunc, $params ) {
				$controllerParts    = explode( '@', $callFunc );
				$controllerParts[0] = explode( '\\', $controllerParts[0] );
				$hmvc               = '';
				$controllerPaths    = count( $controllerParts[0] );

				if ( $controllerPaths > 1 ) {

					foreach ( $controllerParts[0] as $idx => $controllerPart ) {

						if ( $idx == ( $controllerPaths - 1 ) ) {
							break;
						}

						$hmvc .= '\\' . $controllerPart;
					}

				}

				$controller = $hmvc . '\\Controllers\\' . $controllerParts[0][ $controllerPaths - 1 ];
				$c          = new \ReflectionClass( $controller );
				$c          = $c->newInstanceArgs( $params );

				return call_user_func_array( array( $c, $controllerParts[1] ), $this->route->getParams() );
			};

			return $callFunc;

		}

		return $callFunc;
	}
private function createCallbackFromString( $callFunc, $params ) {

		if ( is_string( $callFunc ) ) {
			$callFunc = function () use ( $callFunc, $params ) {
				$controllerParts    = explode( '@', $callFunc );
				$controllerParts[0] = explode( '\\', $controllerParts[0] );
				$hmvc               = '';
				$controllerPaths    = count( $controllerParts[0] );

				if ( $controllerPaths > 1 ) {

					foreach ( $controllerParts[0] as $idx => $controllerPart ) {

						if ( $idx == ( $controllerPaths - 1 ) ) {
							break;
						}

						$hmvc .= '\\' . $controllerPart;
					}

				}

				$controller = $hmvc . '\\Controllers\\' . $controllerParts[0][ $controllerPaths - 1 ];
				$c          = new \ReflectionClass( $controller );
				$c          = $c->newInstanceArgs( $params );

				return call_user_func_array( array( $c, $controllerParts[1] ), $this->route->getParams() );
			};

			return $callFunc;

		}

		return $callFunc;
	}
private function createCallbackFromString ( $ callFunc , $ params ) { if ( is_string ( $ callFunc ) ) { $ callFunc = function ( ) use ( $ callFunc , $ params ) { $ controllerParts = explode ( '@' , $ callFunc ) ; $ controllerParts [ 0 ] = explode ( '\\' , $ controllerParts [ 0 ] ) ; $ hmvc = '' ; $ controllerPaths = count ( $ controllerParts [ 0 ] ) ; if ( $ controllerPaths > 1 ) { foreach ( $ controllerParts [ 0 ] as $ idx => $ controllerPart ) { if ( $ idx == ( $ controllerPaths - 1 ) ) { break ; } $ hmvc .= '\\' . $ controllerPart ; } } $ controller = $ hmvc . '\\Controllers\\' . $ controllerParts [ 0 ] [ $ controllerPaths - 1 ] ; $ c = new \ ReflectionClass ( $ controller ) ; $ c = $ c -> newInstanceArgs ( $ params ) ; return call_user_func_array ( array ( $ c , $ controllerParts [ 1 ] ) , $ this -> route -> getParams ( ) ) ; } ; return $ callFunc ; } return $ callFunc ; }
Create Callback from string

@param $callFunc
@param $params

@return Closure
Create Callback from string