original_string: protected function applyScope(ExtendedRepositoryInterface $repository, $scope = null)
      {
          $scope = (null === $scope) ? $this->activeScope : $scope;
  
          $repository->clearScopes();
  
          if ($this->hasActiveListParent()) {
              return $this;
          }
  
          if ($scope) {
  
              $info = $this->getModelInformation();
  
              $method = $info->list->scopes[ $scope ]->method ?: $scope;
  
              $repository->addScope($method);
          }
  
          return $this;
      }
code: protected function applyScope(ExtendedRepositoryInterface $repository, $scope = null)
      {
          $scope = (null === $scope) ? $this->activeScope : $scope;
  
          $repository->clearScopes();
  
          if ($this->hasActiveListParent()) {
              return $this;
          }
  
          if ($scope) {
  
              $info = $this->getModelInformation();
  
              $method = $info->list->scopes[ $scope ]->method ?: $scope;
  
              $repository->addScope($method);
          }
  
          return $this;
      }
code_tokens: protected function applyScope ( ExtendedRepositoryInterface $ repository , $ scope = null ) { $ scope = ( null === $ scope ) ? $ this -> activeScope : $ scope ; $ repository -> clearScopes ( ) ; if ( $ this -> hasActiveListParent ( ) ) { return $ this ; } if ( $ scope ) { $ info = $ this -> getModelInformation ( ) ; $ method = $ info -> list -> scopes [ $ scope ] -> method ? : $ scope ; $ repository -> addScope ( $ method ) ; } return $ this ; }
docstring: Applies the currently active scope to a repository.
  
  @param ExtendedRepositoryInterface $repository
  @param null|string                 $scope        active if not given
  @return $this
docstring_tokens: Applies the currently active scope to a repository .