public function loadFromJsonFile( $filePath, $folderPath = NULL ){
		if( !file_exists( $filePath ) && $folderPath ){
			$this->assembleJsonFileFromFolder( $filePath, $folderPath );
		}
		$data	= \FS_File_JSON_Reader::load( $filePath );
		foreach( $data as $item ){
			if( !isset( $item->controller ) )
				throw new \OutOfRangeException( 'Route set is missing controller' );
			if( !isset( $item->action ) )
				throw new \OutOfRangeException( 'Route set is missing action' );
			if( !isset( $item->pattern ) )
				throw new \OutOfRangeException( 'Route set is missing pattern' );
			if( !isset( $item->method ) )
				throw new \OutOfRangeException( 'Route set is missing method' );

			$route	= new Route(
				$item->controller,
				$item->action,
				$item->pattern,
				$item->method,
				isset( $item->roles ) ? preg_split( "/, */", trim( $item->roles ) ) : array()
			);
			$this->add( $route );
		}
	}
public function loadFromJsonFile( $filePath, $folderPath = NULL ){
		if( !file_exists( $filePath ) && $folderPath ){
			$this->assembleJsonFileFromFolder( $filePath, $folderPath );
		}
		$data	= \FS_File_JSON_Reader::load( $filePath );
		foreach( $data as $item ){
			if( !isset( $item->controller ) )
				throw new \OutOfRangeException( 'Route set is missing controller' );
			if( !isset( $item->action ) )
				throw new \OutOfRangeException( 'Route set is missing action' );
			if( !isset( $item->pattern ) )
				throw new \OutOfRangeException( 'Route set is missing pattern' );
			if( !isset( $item->method ) )
				throw new \OutOfRangeException( 'Route set is missing method' );

			$route	= new Route(
				$item->controller,
				$item->action,
				$item->pattern,
				$item->method,
				isset( $item->roles ) ? preg_split( "/, */", trim( $item->roles ) ) : array()
			);
			$this->add( $route );
		}
	}
public function loadFromJsonFile ( $ filePath , $ folderPath = NULL ) { if ( ! file_exists ( $ filePath ) && $ folderPath ) { $ this -> assembleJsonFileFromFolder ( $ filePath , $ folderPath ) ; } $ data = \ FS_File_JSON_Reader :: load ( $ filePath ) ; foreach ( $ data as $ item ) { if ( ! isset ( $ item -> controller ) ) throw new \ OutOfRangeException ( 'Route set is missing controller' ) ; if ( ! isset ( $ item -> action ) ) throw new \ OutOfRangeException ( 'Route set is missing action' ) ; if ( ! isset ( $ item -> pattern ) ) throw new \ OutOfRangeException ( 'Route set is missing pattern' ) ; if ( ! isset ( $ item -> method ) ) throw new \ OutOfRangeException ( 'Route set is missing method' ) ; $ route = new Route ( $ item -> controller , $ item -> action , $ item -> pattern , $ item -> method , isset ( $ item -> roles ) ? preg_split ( "/, */" , trim ( $ item -> roles ) ) : array ( ) ) ; $ this -> add ( $ route ) ; } }
Adds a list of routes defined in a JSON file.
@access		public
@param		string		$filePath		Relative or absolute file path of JSON file to load
@param		string		$folderPath		Relative or absolute path to folder containing JSON files to assemble
@return		void
@throws		OutOfRangeException			if route set has no controller
@throws		OutOfRangeException			if route set has no action
@throws		OutOfRangeException			if route set has no pattern
@throws		OutOfRangeException			if route set has no method
Adds a list of routes defined in a JSON file .