public function getContent($type = 'default') {

		if(false === is_string($type)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($type)), E_USER_ERROR);
		}

		if(false === is_dir($this -> directory -> getPath())) {
			return trigger_error(sprintf('Directory "%s" does not exists', $this -> directory -> getPath()), E_USER_ERROR);	
		}

		$files = array_values(array_diff(scandir($this -> directory -> getPath()), ['.', '..']));

		switch($type) {

			case 'array' : 
				return $files;

			case 'object' :
				return (object) $files;

			case 'json' :
				return json_encode($files);

			default : 

				$content = [];

				foreach($files as $file) {

					if(is_dir($this -> directory -> getPath() . $file)) {
						
						$content[] = new Directory($file);
						continue;
					}

					$content[] = new File($file);
				}

				return $content;
		}
	}
public function getContent($type = 'default') {

		if(false === is_string($type)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($type)), E_USER_ERROR);
		}

		if(false === is_dir($this -> directory -> getPath())) {
			return trigger_error(sprintf('Directory "%s" does not exists', $this -> directory -> getPath()), E_USER_ERROR);	
		}

		$files = array_values(array_diff(scandir($this -> directory -> getPath()), ['.', '..']));

		switch($type) {

			case 'array' : 
				return $files;

			case 'object' :
				return (object) $files;

			case 'json' :
				return json_encode($files);

			default : 

				$content = [];

				foreach($files as $file) {

					if(is_dir($this -> directory -> getPath() . $file)) {
						
						$content[] = new Directory($file);
						continue;
					}

					$content[] = new File($file);
				}

				return $content;
		}
	}
public function getContent ( $ type = 'default' ) { if ( false === is_string ( $ type ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ type ) ) , E_USER_ERROR ) ; } if ( false === is_dir ( $ this -> directory -> getPath ( ) ) ) { return trigger_error ( sprintf ( 'Directory "%s" does not exists' , $ this -> directory -> getPath ( ) ) , E_USER_ERROR ) ; } $ files = array_values ( array_diff ( scandir ( $ this -> directory -> getPath ( ) ) , [ '.' , '..' ] ) ) ; switch ( $ type ) { case 'array' : return $ files ; case 'object' : return ( object ) $ files ; case 'json' : return json_encode ( $ files ) ; default : $ content = [ ] ; foreach ( $ files as $ file ) { if ( is_dir ( $ this -> directory -> getPath ( ) . $ file ) ) { $ content [ ] = new Directory ( $ file ) ; continue ; } $ content [ ] = new File ( $ file ) ; } return $ content ; } }
Returns files and folders about the current directory
@param string $type
@return array|object|string
Returns files and folders about the current directory