public function setRequiredType($type)
    {
        if (!in_array($type, array('file', 'directory'))) {
            throw new \InvalidArgumentException("Input type must be either 'file' or 'directory'.");
        }

        if ($type === 'directory') {
            $this->setAllowDirectory(true);
        } else {
            $this->setAllowDirectory(false);
        }

        $this->requiredType = $type;

        return $this;
    }
public function setRequiredType($type)
    {
        if (!in_array($type, array('file', 'directory'))) {
            throw new \InvalidArgumentException("Input type must be either 'file' or 'directory'.");
        }

        if ($type === 'directory') {
            $this->setAllowDirectory(true);
        } else {
            $this->setAllowDirectory(false);
        }

        $this->requiredType = $type;

        return $this;
    }
public function setRequiredType ( $ type ) { if ( ! in_array ( $ type , array ( 'file' , 'directory' ) ) ) { throw new \ InvalidArgumentException ( "Input type must be either 'file' or 'directory'." ) ; } if ( $ type === 'directory' ) { $ this -> setAllowDirectory ( true ) ; } else { $ this -> setAllowDirectory ( false ) ; } $ this -> requiredType = $ type ; return $ this ; }
Set required file input type, must be either 'file' or 'directory'

@param  string $type
@return self
Set required file input type must be either file or directory