diff --git a/Algorithm/Sorting/FonctorInterface.php b/Algorithm/Sorting/FunctorInterface.php similarity index 92% rename from Algorithm/Sorting/FonctorInterface.php rename to Algorithm/Sorting/FunctorInterface.php index 3729f14cf..99f056dc7 100644 --- a/Algorithm/Sorting/FonctorInterface.php +++ b/Algorithm/Sorting/FunctorInterface.php @@ -12,12 +12,12 @@ namespace WBW\Library\Core\Algorithm\Sorting; /** - * Fonctor interface. + * Functor interface. * * @author webeweb * @package WBW\Library\Core\Algorithm\Sorting */ -interface FonctorInterface { +interface FunctorInterface { /** * Compare two values. diff --git a/Algorithm/Sorting/QuickSort.php b/Algorithm/Sorting/QuickSort.php index a88c3fc4d..95ce65741 100644 --- a/Algorithm/Sorting/QuickSort.php +++ b/Algorithm/Sorting/QuickSort.php @@ -20,11 +20,11 @@ class QuickSort { /** - * Fonctor. + * Functor. * - * @var FonctorInterface + * @var FunctorInterface */ - private $fonctor; + private $functor; /** * Values. @@ -37,20 +37,20 @@ class QuickSort { * Constructor. * * @param array $values The values. - * @param FonctorInterface $fonctor The fonctor. + * @param FunctorInterface $functor The fonctor. */ - public function __construct(array $values, FonctorInterface $fonctor) { - $this->setFonctor($fonctor); + public function __construct(array $values, FunctorInterface $functor) { + $this->setFunctor($functor); $this->setValues($values); } /** * Get the fonctor. * - * @return Fonctor Returns the fonctor. + * @return Functor Returns the fonctor. */ - public function getFonctor() { - return $this->fonctor; + public function getFunctor() { + return $this->functor; } /** @@ -78,11 +78,11 @@ private function quickSort($min, $max) { while ($i <= $j) { - while (true === $this->fonctor->compare($this->values[$i], $pivot)) { + while (true === $this->functor->compare($this->values[$i], $pivot)) { ++$i; } - while (true === $this->fonctor->compare($pivot, $this->values[$j])) { + while (true === $this->functor->compare($pivot, $this->values[$j])) { --$j; } @@ -104,11 +104,11 @@ private function quickSort($min, $max) { /** * Set the fonctor. * - * @param FonctorInterface $fonctor The fonctor. + * @param FunctorInterface $fonctor The fonctor. * @return QuickSort Returns this quick sort. */ - public function setFonctor(FonctorInterface $fonctor) { - $this->fonctor = $fonctor; + public function setFunctor(FunctorInterface $fonctor) { + $this->functor = $fonctor; return $this; } diff --git a/Tests/Algorithm/Sorting/QuickSortTest.php b/Tests/Algorithm/Sorting/QuickSortTest.php index 4d8040e4f..35d4d9def 100644 --- a/Tests/Algorithm/Sorting/QuickSortTest.php +++ b/Tests/Algorithm/Sorting/QuickSortTest.php @@ -12,9 +12,9 @@ namespace WBW\Library\Core\Tests\Algorithm\Sorting; use PHPUnit_Framework_TestCase; -use WBW\Library\Core\Algorithm\Sorting\FonctorInterface; +use WBW\Library\Core\Algorithm\Sorting\FunctorInterface; use WBW\Library\Core\Algorithm\Sorting\QuickSort; -use WBW\Library\Core\Tests\Fixtures\Algorithm\Sorting\IntegerFonctor; +use WBW\Library\Core\Tests\Fixtures\Algorithm\Sorting\IntegerFunctor; /** * Quick sort test. @@ -26,9 +26,9 @@ final class QuickSortTest extends PHPUnit_Framework_TestCase { /** - * Fonctor. + * Functor. * - * @var FonctorInterface + * @var FunctorInterface */ private $fonctor; @@ -45,7 +45,7 @@ final class QuickSortTest extends PHPUnit_Framework_TestCase { protected function setUp() { // Set the fonctor mock. - $this->fonctor = new IntegerFonctor(); + $this->fonctor = new IntegerFunctor(); // Set the values mock. $this->values = [12, 98, 21, 89, 23, 87, 32, 78, 34, 76, 43, 67, 45, 65, 54, 56,]; @@ -60,7 +60,7 @@ public function testConstruct() { $obj = new QuickSort($this->values, $this->fonctor); - $this->assertSame($this->fonctor, $obj->getFonctor()); + $this->assertSame($this->fonctor, $obj->getFunctor()); $this->assertSame($this->values, $obj->getValues()); } diff --git a/Tests/Fixtures/Algorithm/Sorting/IntegerFonctor.php b/Tests/Fixtures/Algorithm/Sorting/IntegerFunctor.php similarity index 79% rename from Tests/Fixtures/Algorithm/Sorting/IntegerFonctor.php rename to Tests/Fixtures/Algorithm/Sorting/IntegerFunctor.php index 9f303c72a..e23376b43 100644 --- a/Tests/Fixtures/Algorithm/Sorting/IntegerFonctor.php +++ b/Tests/Fixtures/Algorithm/Sorting/IntegerFunctor.php @@ -11,16 +11,16 @@ namespace WBW\Library\Core\Tests\Fixtures\Algorithm\Sorting; -use WBW\Library\Core\Algorithm\Sorting\FonctorInterface; +use WBW\Library\Core\Algorithm\Sorting\FunctorInterface; /** - * Integer fonctor. + * Integer functor. * * @author webeweb * @package WBW\Library\Core\Tests\Fixtures\Node * @final */ -final class IntegerFonctor implements FonctorInterface { +final class IntegerFunctor implements FunctorInterface { /** * {@inheritdoc}