/** * @throws \LogicException * To be called from validate() when packages have to have 3 dimensions and weight */ protected function validatePackages() { foreach ($this->shipment->getPackages() as $package) { Validator::checkIfNull($package->getWeight(), 'weight'); Validator::checkIfNull($package->getLength(), 'length'); Validator::checkIfNull($package->getHeight(), 'height'); Validator::checkIfNull($package->getWidth(), 'width'); } }
protected function validate() { $this->validatePackages(); Validator::checkIfNull($this->username, 'username'); Validator::checkIfNull($this->password, 'password'); Validator::checkIfNull($this->shipment->getFromPostalCode(), 'fromPostalCode'); Validator::checkIfNull($this->shipment->getToPostalCode(), 'toPostalCode'); return $this; }
protected function validate() { $this->validatePackages(); Validator::checkIfNull($this->key, 'key'); Validator::checkIfNull($this->password, 'password'); Validator::checkIfNull($this->accountNumber, 'accountNumber'); Validator::checkIfNull($this->meterNumber, 'meterNumber'); Validator::checkIfNull($this->shipment->getFromPostalCode(), 'fromPostalCode'); Validator::checkIfNull($this->shipment->getFromCountryCode(), 'fromCountryCode'); Validator::checkIfNull($this->shipment->getFromIsResidential(), 'fromIsResidential'); Validator::checkIfNull($this->shipment->getToPostalCode(), 'toPostalCode'); Validator::checkIfNull($this->shipment->getToCountryCode(), 'toCountryCode'); Validator::checkIfNull($this->shipment->getToIsResidential(), 'toIsResidential'); return $this; }