src/Uploading/StrategiesQueue.php
public function attach(UploadStrategyInterface $strategy, $priority)
    {
        if ($this->started) {
            throw new RuntimeException('Unable during invoking.');
        }
        if (isset($this->queue[$priority])) {
            throw new InvalidArgumentException(sprintf(
                'The strategy with priority "%s" already exists.',
                $priority
            ));
        }
        $this->queue[$priority] = $strategy;
        $this->sortedQueue      = null;

        if ($this->options && ! $strategy->getOptions()) {
            $strategy->setOptions($this->options);
        }

        return $this;
    }
public function attach(UploadStrategyInterface $strategy, $priority)
    {
        if ($this->started) {
            throw new RuntimeException('Unable during invoking.');
        }
        if (isset($this->queue[$priority])) {
            throw new InvalidArgumentException(sprintf(
                'The strategy with priority "%s" already exists.',
                $priority
            ));
        }
        $this->queue[$priority] = $strategy;
        $this->sortedQueue      = null;

        if ($this->options && ! $strategy->getOptions()) {
            $strategy->setOptions($this->options);
        }

        return $this;
    }
public function attach ( UploadStrategyInterface $ strategy , $ priority ) { if ( $ this -> started ) { throw new RuntimeException ( 'Unable during invoking.' ) ; } if ( isset ( $ this -> queue [ $ priority ] ) ) { throw new InvalidArgumentException ( sprintf ( 'The strategy with priority "%s" already exists.' , $ priority ) ) ; } $ this -> queue [ $ priority ] = $ strategy ; $ this -> sortedQueue = null ; if ( $ this -> options && ! $ strategy -> getOptions ( ) ) { $ strategy -> setOptions ( $ this -> options ) ; } return $ this ; }
Attaches the upload strategy to specific priority.

@param UploadStrategyInterface $strategy The upload strategy
@param int                     $priority The priority

@throws \RuntimeException         If try to attach during invoking
@throws \InvalidArgumentException If the specified priority have already
some strategy

@return self
Attaches the upload strategy to specific priority .