Skip to content

Commit

Permalink
add docs for aggragation function fixes #501 (#510)
Browse files Browse the repository at this point in the history
* add docs for aggragation function fixes #501

* add missing reference fixes #501
  • Loading branch information
andythedandy authored and sagikazarmark committed Dec 5, 2018
1 parent c3de57d commit 5a7dc2c
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
44 changes: 44 additions & 0 deletions doc/features/aggregation.rst
@@ -0,0 +1,44 @@
.. _aggregation:

Aggregation
===========

``min()`` returns the smallest of the given Money objects

.. code-block:: php
$first = Money::EUR(100); // €1.00
$second = Money::EUR(200); // €2.00
$third = Money::EUR(300); // €3.00
$min = Money::min($first, $second, $third) // €1.00
``max()`` returns the largest of the given Money objects

.. code-block:: php
$first = Money::EUR(100); // €1.00
$second = Money::EUR(200); // €2.00
$third = Money::EUR(300); // €3.00
$max = Money::max($first, $second, $third) // €3.00
``avg()`` returns the average value of the given Money objects as a Money object

.. code-block:: php
$first = Money::EUR(100); // €1.00
$second = Money::EUR(-200); // -€2.00
$third = Money::EUR(300); // €3.00
$avg = Money::avg($first, $second, $third) // €2.00
``sum()`` provides the sum of all given Money objects

.. code-block:: php
$first = Money::EUR(100); // €1.00
$second = Money::EUR(-200); // -€2.00
$third = Money::EUR(300); // €3.00
$sum = Money::sum($first, $second, $third) // €2.00
1 change: 1 addition & 0 deletions doc/index.rst
Expand Up @@ -47,6 +47,7 @@ subtle intricacies of handling money.
features/allocation
features/parsing
features/formatting
features/aggregation

.. toctree::
:hidden:
Expand Down

0 comments on commit 5a7dc2c

Please sign in to comment.