Files
DesignPatternsPHP/Behavioral/Strategy/IdComparator.php
Antonio Spinelli e59d70a0ac start a restructure
2014-03-21 18:03:45 -03:00

22 lines
346 B
PHP

<?php
namespace DesignPatterns\Strategy;
/**
* Class IdComparator
*/
class IdComparator implements ComparatorInterface
{
/**
* {@inheritdoc}
*/
public function compare($a, $b)
{
if ($a['id'] == $b['id']) {
return 0;
} else {
return $a['id'] < $b['id'] ? -1 : 1;
}
}
}