/**
  * Constructor
  */
 public function __construct(DateTime $start)
 {
     $this->start = $start;
     if (!$start instanceof DateTime) {
         throw new InvalidArgumentException(sprintf("First argument must be instance of the DateTime. '%s' given", is_object($start) ? get_class($start) : gettype($start)));
     }
     parent::__construct(new ServiceIterator());
 }
 /**
  * Constructor
  *
  * @param    ArrayCollection     $collection  Collection of the projects
  * @param    string              $ccId        Identifier of the cost centre to check
  * @param    Scalr_Account_User  $user        optional The user
  * @param    Scalr_Environment   $environment optional An envrironment
  * @throws   InvalidArgumentException
  */
 public function __construct(ArrayCollection $collection, $ccId, Scalr_Account_User $user = null, Scalr_Environment $environment = null)
 {
     parent::__construct($collection->getIterator());
     if ($user !== null && !$user instanceof Scalr_Account_User) {
         throw new InvalidArgumentException("User argument must be instance of the Scalr_Account_User class.");
     }
     $this->user = $user;
     if ($environment !== null && !$environment instanceof Scalr_Environment) {
         throw new InvalidArgumentException("Environment argument must be instance of the Scalr_Environment class.");
     }
     $this->environment = $environment;
     $this->ccId = $ccId;
     $this->default = $this->user === null && $this->environment === null;
 }
Example #3
0
 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct(new ServiceIterator());
 }