LibCloud\Compute\Model\NodeState::toString PHP Method

toString() public static method

public static toString ( $state )
    public static function toString($state)
    {
        $class = new \ReflectionClass(__CLASS__);
        foreach ($class->getConstants() as $string => $int) {
            if ($int == $state) {
                return $string;
            }
        }
        throw new \Exception('Undefined state ' . $state . ' in NodeState class');
    }

Usage Example

Esempio n. 1
0
 protected function toNode($response)
 {
     //print_r($response);
     $public_ips = $private_ips = $extra = [];
     $ips = $this->listIps($response->getId());
     foreach ($ips as $ip) {
         if ($ip['public']) {
             $public_ips[] = $ip['ipAddress'];
         } else {
             $private_ips[] = $ip['ipAddress'];
         }
     }
     $size = $this->listSizes($response['PLANID']);
     $image = new NodeImage(null, null, 'linode');
     return new Node($response['LINODEID'], $response['LABEL'], NodeState::toString($this->stateMap[$response['STATUS']]), $public_ips, $private_ips, 'linode', $size, $image, ['distributionvendor' => $response['DISTRIBUTIONVENDOR']]);
 }
All Usage Examples Of LibCloud\Compute\Model\NodeState::toString
NodeState