summaryrefslogtreecommitdiff
path: root/bin/lib/OsikaParser.php
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2015-02-05 16:05:00 +0100
committeremkael <emkael@tlen.pl>2015-02-05 16:05:00 +0100
commita7685f1bc2be4993ac568188ff6e6eee03c43281 (patch)
treefbdef7a5034b97b94be4ed0fbeafb6f927fef651 /bin/lib/OsikaParser.php
parent0ee6b2788ce92cf9cfeeebffc40162decaa9e0d6 (diff)
Fixes #1
Diffstat (limited to 'bin/lib/OsikaParser.php')
-rw-r--r--bin/lib/OsikaParser.php20
1 files changed, 10 insertions, 10 deletions
diff --git a/bin/lib/OsikaParser.php b/bin/lib/OsikaParser.php
index d2046f4..b134bb9 100644
--- a/bin/lib/OsikaParser.php
+++ b/bin/lib/OsikaParser.php
@@ -39,19 +39,19 @@ class OsikaParser {
}
// ...queens...
if ($cardA == 'q') {
- return (in_array($cardB, array('a', 'k'))) ? 1 : -1;
+ return (in_array($cardB, ['a', 'k'])) ? 1 : -1;
}
// ...jacks...
if ($cardA == 'j') {
- return (in_array($cardB, array('a', 'k', 'q'))) ? 1 : -1;
+ return (in_array($cardB, ['a', 'k', 'q'])) ? 1 : -1;
}
// ...tens...
if ($cardA == 't') {
- return (in_array($cardB, array('a', 'k', 'q', 'j'))) ? 1 : -1;
+ return (in_array($cardB, ['a', 'k', 'q', 'j'])) ? 1 : -1;
}
// ... and nines
if ($cardA == '9') {
- return (in_array($cardB, array('a', 'k', 'q', 'j', 't'))) ? 1 : -1;
+ return (in_array($cardB, ['a', 'k', 'q', 'j', 't'])) ? 1 : -1;
}
// anything else goes last, as it was
return 1;
@@ -62,7 +62,7 @@ class OsikaParser {
**/
private function _sortSuit(&$suit) {
$temp = str_split($suit);
- usort($temp, array($this, '_sort'));
+ usort($temp, [$this, '_sort']);
$suit = implode('', $temp);
}
@@ -77,10 +77,10 @@ class OsikaParser {
$this->_hand = strtolower($this->_hand);
// allow (and interpret) Polish figures abbrevs. and "10" as Ten
$this->_hand = strtr($this->_hand,
- array(
- '10' => 't',
- 'w' => 'j',
- 'd' => 'q'));
+ [
+ '10' => 't',
+ 'w' => 'j',
+ 'd' => 'q']);
// strip whitespace
$this->_hand = preg_replace('/\s/', '', $this->_hand);
$suits = explode('|', $this->_hand);
@@ -95,7 +95,7 @@ class OsikaParser {
throw new OsikaParserException('Kolor '.$suit.' zawiera nieprawidłowe znaki', OsikaParserException::INVALID_CHARS);
}
// check for duplicate cards
- foreach (array('a', 'k', 'q', 'j', 't', '9') as $honor) {
+ foreach (['a', 'k', 'q', 'j', 't', '9'] as $honor) {
if (substr_count($suit, $honor) > 1) {
throw new OsikaParserException('Kolor '.$suit.' zawiera zduplikowany honor (lub 9)', OsikaParserException::DUPLICATE_CHARS);
}