public static function getSources()
  {
    $item = Container::cache(__CLASS__)->getItem('sources');
    if ($item->isHit()) {
      return $item->get();
    }

    // The PolicySource config directive loads in class names that provides
    // policies for Drutiny to use. We need to validate each provided source
    // implements PolicySourceInterface.
    $sources = array_filter(array_map(function ($class) {
      $object = new $class();
      if (!($object instanceof ProfileSourceInterface)) {
        return false;
      }
      return $object;
    }, Config::get('ProfileSource')));

    // If multiple sources provide the same policy by name, then the policy from
    // the first source in the list will by used.
    usort($sources, function ($a, $b) {
      if ($a->getWeight() == $b->getWeight()) {
        return 0;
      }
      return $a->getWeight() > $b->getWeight() ? 1 : -1;
    });

    Container::cache(__CLASS__)->save(
      $item->set($sources)->expiresAfter(3600)
    );
    return $sources;
  }
public static function getSources()
  {
    $item = Container::cache(__CLASS__)->getItem('sources');
    if ($item->isHit()) {
      return $item->get();
    }

    // The PolicySource config directive loads in class names that provides
    // policies for Drutiny to use. We need to validate each provided source
    // implements PolicySourceInterface.
    $sources = array_filter(array_map(function ($class) {
      $object = new $class();
      if (!($object instanceof ProfileSourceInterface)) {
        return false;
      }
      return $object;
    }, Config::get('ProfileSource')));

    // If multiple sources provide the same policy by name, then the policy from
    // the first source in the list will by used.
    usort($sources, function ($a, $b) {
      if ($a->getWeight() == $b->getWeight()) {
        return 0;
      }
      return $a->getWeight() > $b->getWeight() ? 1 : -1;
    });

    Container::cache(__CLASS__)->save(
      $item->set($sources)->expiresAfter(3600)
    );
    return $sources;
  }
public static function getSources ( ) { $ item = Container :: cache ( __CLASS__ ) -> getItem ( 'sources' ) ; if ( $ item -> isHit ( ) ) { return $ item -> get ( ) ; } // The PolicySource config directive loads in class names that provides // policies for Drutiny to use. We need to validate each provided source // implements PolicySourceInterface. $ sources = array_filter ( array_map ( function ( $ class ) { $ object = new $ class ( ) ; if ( ! ( $ object instanceof ProfileSourceInterface ) ) { return false ; } return $ object ; } , Config :: get ( 'ProfileSource' ) ) ) ; // If multiple sources provide the same policy by name, then the policy from // the first source in the list will by used. usort ( $ sources , function ( $ a , $ b ) { if ( $ a -> getWeight ( ) == $ b -> getWeight ( ) ) { return 0 ; } return $ a -> getWeight ( ) > $ b -> getWeight ( ) ? 1 : - 1 ; } ) ; Container :: cache ( __CLASS__ ) -> save ( $ item -> set ( $ sources ) -> expiresAfter ( 3600 ) ) ; return $ sources ; }
Load the sources that provide policies.

@return array of PolicySourceInterface objects.
Load the sources that provide policies .