/**
  * Parse the status query.
  *
  * @since 1.0
  *
  * @return Where|null
  */
 protected function parse_status()
 {
     if ($this->args['status'] === 'any') {
         return null;
     } else {
         $white_list = Activation::get_statuses();
         $statuses = (array) $this->args['status'];
         foreach ($statuses as $status) {
             if (!isset($white_list[$status])) {
                 throw new \InvalidArgumentException("Invalid status {$status}");
             }
         }
         return new Where('q.status', true, (array) $this->args['status']);
     }
 }
 public function test_statuses_exist()
 {
     $statuses = Activation::get_statuses();
     $this->assertArrayHasKey('active', $statuses, 'Active status does not exist.');
     $this->assertArrayHasKey('deactivated', $statuses, 'Deactivated status does not exist.');
     $this->assertArrayHasKey('expired', $statuses, 'Expired status does not exist.');
 }
 /**
  * Get all activations of this license key.
  *
  * @since 1.0
  *
  * @param string $status
  *
  * @return Activation[]
  */
 public function get_activations($status = '')
 {
     $args = array('key' => $this->get_key());
     if ($status) {
         if (!array_key_exists($status, Activation::get_statuses())) {
             throw new \InvalidArgumentException("Invalid status");
         }
         $args['status'] = $status;
     }
     return itelic_get_activations($args);
 }