lib/Touki/FTP/PermissionsFactory.php
public function build($input)
    {
        if (strlen($input) != 3) {
            throw new \InvalidArgumentException(sprintf("%s is not a valid permission input", $input));
        }

        $perms = 0;

        if ('r' === substr($input, 0, 1)) {
            $perms |= Permissions::READABLE;
        }

        if ('w' === substr($input, 1, 1)) {
            $perms |= Permissions::WRITABLE;
        }

        if ('x' === substr($input, 2, 1)) {
            $perms |= Permissions::EXECUTABLE;
        }

        $permissions = new Permissions;
        $permissions->setFlags($perms);

        return $permissions;
    }
public function build($input)
    {
        if (strlen($input) != 3) {
            throw new \InvalidArgumentException(sprintf("%s is not a valid permission input", $input));
        }

        $perms = 0;

        if ('r' === substr($input, 0, 1)) {
            $perms |= Permissions::READABLE;
        }

        if ('w' === substr($input, 1, 1)) {
            $perms |= Permissions::WRITABLE;
        }

        if ('x' === substr($input, 2, 1)) {
            $perms |= Permissions::EXECUTABLE;
        }

        $permissions = new Permissions;
        $permissions->setFlags($perms);

        return $permissions;
    }
public function build ( $ input ) { if ( strlen ( $ input ) != 3 ) { throw new \ InvalidArgumentException ( sprintf ( "%s is not a valid permission input" , $ input ) ) ; } $ perms = 0 ; if ( 'r' === substr ( $ input , 0 , 1 ) ) { $ perms |= Permissions :: READABLE ; } if ( 'w' === substr ( $ input , 1 , 1 ) ) { $ perms |= Permissions :: WRITABLE ; } if ( 'x' === substr ( $ input , 2 , 1 ) ) { $ perms |= Permissions :: EXECUTABLE ; } $ permissions = new Permissions ; $ permissions -> setFlags ( $ perms ) ; return $ permissions ; }
Builds a Permissions object

@param  string      $input Permissions string
@return Permissions
Builds a Permissions object