src/S3/StreamWrapper.php
private function validate($path, $mode)
    {
        $errors = [];

        if (!$this->getOption('Key')) {
            $errors[] = 'Cannot open a bucket. You must specify a path in the '
                . 'form of s3://bucket/key';
        }

        if (!in_array($mode, ['r', 'w', 'a', 'x'])) {
            $errors[] = "Mode not supported: {$mode}. "
                . "Use one 'r', 'w', 'a', or 'x'.";
        }

        // When using mode "x" validate if the file exists before attempting
        // to read
        if ($mode == 'x' &&
            $this->getClient()->doesObjectExist(
                $this->getOption('Bucket'),
                $this->getOption('Key'),
                $this->getOptions(true)
            )
        ) {
            $errors[] = "{$path} already exists on Amazon S3";
        }

        return $errors;
    }
private function validate($path, $mode)
    {
        $errors = [];

        if (!$this->getOption('Key')) {
            $errors[] = 'Cannot open a bucket. You must specify a path in the '
                . 'form of s3://bucket/key';
        }

        if (!in_array($mode, ['r', 'w', 'a', 'x'])) {
            $errors[] = "Mode not supported: {$mode}. "
                . "Use one 'r', 'w', 'a', or 'x'.";
        }

        // When using mode "x" validate if the file exists before attempting
        // to read
        if ($mode == 'x' &&
            $this->getClient()->doesObjectExist(
                $this->getOption('Bucket'),
                $this->getOption('Key'),
                $this->getOptions(true)
            )
        ) {
            $errors[] = "{$path} already exists on Amazon S3";
        }

        return $errors;
    }
private function validate ( $ path , $ mode ) { $ errors = [ ] ; if ( ! $ this -> getOption ( 'Key' ) ) { $ errors [ ] = 'Cannot open a bucket. You must specify a path in the ' . 'form of s3://bucket/key' ; } if ( ! in_array ( $ mode , [ 'r' , 'w' , 'a' , 'x' ] ) ) { $ errors [ ] = "Mode not supported: {$mode}. " . "Use one 'r', 'w', 'a', or 'x'." ; } // When using mode "x" validate if the file exists before attempting // to read if ( $ mode == 'x' && $ this -> getClient ( ) -> doesObjectExist ( $ this -> getOption ( 'Bucket' ) , $ this -> getOption ( 'Key' ) , $ this -> getOptions ( true ) ) ) { $ errors [ ] = "{$path} already exists on Amazon S3" ; } return $ errors ; }
Validates the provided stream arguments for fopen and returns an array
of errors.
Validates the provided stream arguments for fopen and returns an array of errors .