original_string: public function setStorage($storage)
      {
          if (is_string($storage)) {
              $storage = $this->getStoragePlugins()->get($storage);
          } elseif (is_array($storage)) {
              if (!isset($storage['name'])) {
                  throw new \Exception('Invalid Storage configuration: Name required.');
              }
              $storage = $this->getStoragePlugins()->get($storage['name'], $storage);
          }
          
          if (!$storage instanceof Storage\StorageInterface) {
              throw new \Exception('Storage must be instance of Spork\Mvc\Listener\Limit\Storage\StorageInterface');
          }
          
          $this->storage = $storage;
          return $this;
      }
code: public function setStorage($storage)
      {
          if (is_string($storage)) {
              $storage = $this->getStoragePlugins()->get($storage);
          } elseif (is_array($storage)) {
              if (!isset($storage['name'])) {
                  throw new \Exception('Invalid Storage configuration: Name required.');
              }
              $storage = $this->getStoragePlugins()->get($storage['name'], $storage);
          }
          
          if (!$storage instanceof Storage\StorageInterface) {
              throw new \Exception('Storage must be instance of Spork\Mvc\Listener\Limit\Storage\StorageInterface');
          }
          
          $this->storage = $storage;
          return $this;
      }
code_tokens: public function setStorage ( $ storage ) { if ( is_string ( $ storage ) ) { $ storage = $ this -> getStoragePlugins ( ) -> get ( $ storage ) ; } elseif ( is_array ( $ storage ) ) { if ( ! isset ( $ storage [ 'name' ] ) ) { throw new \ Exception ( 'Invalid Storage configuration: Name required.' ) ; } $ storage = $ this -> getStoragePlugins ( ) -> get ( $ storage [ 'name' ] , $ storage ) ; } if ( ! $ storage instanceof Storage \ StorageInterface ) { throw new \ Exception ( 'Storage must be instance of Spork\Mvc\Listener\Limit\Storage\StorageInterface' ) ; } $ this -> storage = $ storage ; return $ this ; }
docstring: Set storage instance
  
  @param StorageInterface|string|array $storage
  @return \Spork\Mvc\Listener\Limit\LimitStrategy
  @throws \Exception on invalid type
docstring_tokens: Set storage instance