-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ef9bc0
commit 23d1a68
Showing
12 changed files
with
72 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/ChrisKonnertz/StringCalc/Symbols/Concrete/Functions/IntDivFunction.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace ChrisKonnertz\StringCalc\Symbols\Concrete\Functions; | ||
|
||
use ChrisKonnertz\StringCalc\Symbols\AbstractFunction; | ||
|
||
/** | ||
* PHP intdiv() function aka integer division. | ||
* Expects two parameters. The first is the | ||
* number to be divided, the second is the | ||
* number which divides the dividend. | ||
* @see http://php.net/manual/en/ref.math.php | ||
*/ | ||
class IntDivFunction extends AbstractFunction | ||
{ | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected $identifiers = ['intDiv']; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function execute(array $arguments) | ||
{ | ||
if (sizeof($arguments) != 2) { | ||
throw new \InvalidArgumentException('Error: Expected two argument, got '.sizeof($arguments)); | ||
} | ||
|
||
$firstNumber = $arguments[0]; | ||
$secondNumber = $arguments[1]; | ||
|
||
return intdiv($firstNumber, $secondNumber); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters