src/FormatFactory.php
public function getFormat($name, $filePath, $mode) {
        $formats = $this->getFormats();
        if (!isset($formats[$name])) {
            throw new Exception("Format `$name` is not registered");
        }
        if (!is_callable($formats[$name])) {
            throw new Exception("Cannot generate format `$name`");
        }
        $format = call_user_func($formats[$name], $filePath, $mode);
        if (!$format instanceof Format) {
            throw new Exception("Cannot generate format `$name`");
        }
        return $format;
    }
public function getFormat($name, $filePath, $mode) {
        $formats = $this->getFormats();
        if (!isset($formats[$name])) {
            throw new Exception("Format `$name` is not registered");
        }
        if (!is_callable($formats[$name])) {
            throw new Exception("Cannot generate format `$name`");
        }
        $format = call_user_func($formats[$name], $filePath, $mode);
        if (!$format instanceof Format) {
            throw new Exception("Cannot generate format `$name`");
        }
        return $format;
    }
public function getFormat ( $ name , $ filePath , $ mode ) { $ formats = $ this -> getFormats ( ) ; if ( ! isset ( $ formats [ $ name ] ) ) { throw new Exception ( "Format `$name` is not registered" ) ; } if ( ! is_callable ( $ formats [ $ name ] ) ) { throw new Exception ( "Cannot generate format `$name`" ) ; } $ format = call_user_func ( $ formats [ $ name ] , $ filePath , $ mode ) ; if ( ! $ format instanceof Format ) { throw new Exception ( "Cannot generate format `$name`" ) ; } return $ format ; }
Returns new format object
@param string $name
@param string $filePath
@param integer $mode
@return \org\majkel\dbase\Format
@throws Exception
Returns new format object