Skip to content

Commit

Permalink
Fixed the return values of \Didww\Item\BaseItem's children (#57)
Browse files Browse the repository at this point in the history
* fixed the return values of `\Didww\Item\BaseItem`'s children

* added `php-http/discovery` package to allowed plugins

* code style is fixed

* added return value to the `\Didww\Item\OrderItem\Base` class

* fixed the return value of `CapacityPool::getRenewDate()` method

---------

Co-authored-by: Andrey Bakharev <[email protected]>
  • Loading branch information
BOPOH and BOPOH authored Feb 17, 2023
1 parent b62410a commit 6dad2f1
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,10 @@
"test": "XDEBUG_MODE=coverage phpunit",
"check-style": "php-cs-fixer fix --dry-run -v",
"fix-style": "php-cs-fixer fix"
}
},
"config": {
"allow-plugins": {
"php-http/discovery": true
}
}
}
4 changes: 2 additions & 2 deletions src/Item/CapacityPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public function getName(): string
return $this->getAttributes()['name'];
}

public function getRenewDate(): \Date
public function getRenewDate(): \DateTime
{
return new \Date($this->getAttributes()['renew_date']);
return new \DateTime($this->getAttributes()['renew_date']);
}

public function getTotalChannelsCount(): int
Expand Down
2 changes: 2 additions & 0 deletions src/Item/Configuration/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public function getAttributes()
public function fill(array $attributes)
{
$this->attributes = $attributes;

return $this;
}

private static $didPlaceHolder = '{DID}';
Expand Down
3 changes: 2 additions & 1 deletion src/Item/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ public function fill(array $attributes)
$this->fillItems($attributes['items']);
unset($attributes['items']);
}
parent::fill($attributes);

return parent::fill($attributes);
}

private function fillItems($items)
Expand Down
7 changes: 6 additions & 1 deletion src/Item/OrderItem/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,17 @@ public function getCreatableAttributes(): array
return $creatableAttributes;
}

public function fill(array $attributes)
/**
* @return $this
*/
public function fill(array $attributes): self
{
// remove deprecated attributes
unset($attributes['monthly_price']);
unset($attributes['setup_price']);
$this->attributes = $attributes;

return $this;
}

public function getNrc(): float
Expand Down
3 changes: 2 additions & 1 deletion src/Item/VoiceInTrunk.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ public function fill(array $attributes)
$this->fillConfiguration($attributes['configuration']);
unset($attributes['configuration']);
}
parent::fill($attributes);

return parent::fill($attributes);
}

private function fillConfiguration($configuration)
Expand Down

0 comments on commit 6dad2f1

Please sign in to comment.