LibCloud\Compute\Providers\Rackspace\RackspaceProvider::listLocations PHP Метод

listLocations() публичный Метод

public listLocations ( $nodeLocationId = null )
    public function listLocations($nodeLocationId = null)
    {
        $locations = array();
        if (!$nodeLocationId) {
            foreach ($this->locations as $_ => $loc) {
                $locations[] = $loc;
            }
        } else {
            if (array_key_exists($nodeLocationId, $this->locations)) {
                $locations[] = $this->locations[$nodeLocationId];
            }
        }
        return array_map(array($this, 'toLocation'), $locations);
    }

Usage Example

 public function testListLocationsWithId()
 {
     $expectedId = 'HKG';
     $images = $this->provider->listLocations($expectedId);
     $this->assertCount(1, $images, 'listLocations returns an array with exactly one item');
     $this->assertSame($expectedId, $images[0]->getId(), 'The NodeLocation ID matches the ID that was requested');
 }