Scalr\Acl\Acl::getResourcesMnemonic PHP Method

getResourcesMnemonic() public static method

This method excludes disabled resources.
public static getResourcesMnemonic ( ) : array
return array Returns all resources looks like array(resourceId => mnemonicIndex)
    public static function getResourcesMnemonic()
    {
        $res = array();
        $refl = new \ReflectionClass(get_called_class());
        foreach ($refl->getConstants() as $name => $resourceId) {
            if (strpos($name, 'RESOURCE_') === 0 && Resource\Definition::has($resourceId)) {
                $res[$resourceId] = substr($name, 9);
            }
        }
        //Removes disabled resources
        foreach (self::getDisabledResources() as $resourceId) {
            if (isset($res[$resourceId])) {
                unset($res[$resourceId]);
            }
        }
        return $res;
    }

Usage Example

Example #1
0
 /**
  * Provider method for testGet() test
  */
 public function providerGet()
 {
     $refl = new \ReflectionClass('Scalr\\Acl\\Acl');
     $arguments = array();
     //Fetches all resources which have been defined in the Acl class except excluded
     foreach (Acl::getResourcesMnemonic() as $resourceId => $mnemonicName) {
         $arguments[] = array($resourceId);
     }
     return $arguments;
 }
All Usage Examples Of Scalr\Acl\Acl::getResourcesMnemonic