diff --git a/src/Common/Sql.php b/src/Common/Sql.php index cd02dc3..7ee3a98 100644 --- a/src/Common/Sql.php +++ b/src/Common/Sql.php @@ -56,7 +56,8 @@ abstract class Sql { $this->identifier = $identifier; } - public function __toString() { + public function __toString() : string + { return $this->identifier; } }; diff --git a/src/EntityCollection.php b/src/EntityCollection.php index 1802787..7c6216e 100644 --- a/src/EntityCollection.php +++ b/src/EntityCollection.php @@ -222,6 +222,11 @@ class EntityCollection extends \ArrayObject { return $list; } + public function sum($field) : float|int + { + return array_sum($this->column($field)); + } + public function unique(\Stringable|callable|string $field, bool $strict = false) : self { $list = [];