Skip to content

Commit

Permalink
ensuring that all cards have a name attribute, not just Hearts and Di…
Browse files Browse the repository at this point in the history
…amonds
  • Loading branch information
farfromunique committed Jun 1, 2015
1 parent 781a05f commit 50b3d00
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions classes/PowerTwist.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@ public function __construct ($target = ['Poker','RandomValue','RandomSuit']) {
$this->twist['Suit'] = $this->twist['Suit'][0];
$this->twist['Value'] = $this->twist['Value'][0];

if ($this->twist['Suit']['name'] === 'Spades' || $this->twist['Suit']['name'] === 'Clubs') {
if ($this->twist['Suit']['name'] === 'Spades'
|| $this->twist['Suit']['name'] === 'Clubs') {
$this->twist['image'] = '/card/r-' . strtolower($this->twist['Value']['name']) . '.' . strtolower($this->twist['Suit']['name']);
} else {
$this->twist['image'] = '/card/b-' . strtolower($this->twist['Value']['name']) . '.' . strtolower($this->twist['Suit']['name']);

$this->twist['name'] = $this->twist['Value']['name'] . ' of ' . $this->twist['Suit']['name'];
}
$this->twist['image'] = '/card/b-'
. strtolower($this->twist['Value']['name']) . '.'
. strtolower($this->twist['Suit']['name']);
}
$this->twist['name'] = $this->twist['Value']['name']
. ' of ' . $this->twist['Suit']['name'];

} else {
$this->twist['Tarot'] = $this->array_random_assoc($this->twistList['Tarot']);
$this->twist['Tarot'] = $this->twist['Tarot'][0];
Expand All @@ -43,13 +47,18 @@ public function __construct ($target = ['Poker','RandomValue','RandomSuit']) {
$this->twist['Suit'] = $this->twistList['Suit'][$target[2]];


if ($this->twist['Suit']['name'] === 'Spades' || $this->twist['Suit']['name'] === 'Clubs') {
$this->twist['image'] = '/card/r-' . strtolower($this->twist['Value']['name']) . '.' . strtolower($this->twist['Suit']['name']);
if ($this->twist['Suit']['name'] === 'Spades'
|| $this->twist['Suit']['name'] === 'Clubs') {
$this->twist['image'] = '/card/r-'
. strtolower($this->twist['Value']['name']) . '.'
. strtolower($this->twist['Suit']['name']);
} else {
$this->twist['image'] = '/card/b-' . strtolower($this->twist['Value']['name']) . '.' . strtolower($this->twist['Suit']['name']);

$this->twist['name'] = $this->twist['Value']['name'] . ' of ' . $this->twist['Suit']['name'];
$this->twist['image'] = '/card/b-'
. strtolower($this->twist['Value']['name']) . '.'
. strtolower($this->twist['Suit']['name']);
}
$this->twist['name'] = $this->twist['Value']['name']
. ' of ' . $this->twist['Suit']['name'];
} else {
$this->twist['Tarot'] = $this->array_random_assoc($this->twistList['Tarot']);
$this->twist['Tarot'] = $this->twist['Tarot'][0];
Expand All @@ -61,7 +70,7 @@ public function __construct ($target = ['Poker','RandomValue','RandomSuit']) {
public function getBigImageCell() {
$output = "\t\t" . '<td>' . "\n";
$output .= "\t\t\t" . '<img src="' . $this->twist['image'] . '"><br />' . "\n";
$output .= "\t\t\t" . $this->twist['name'] . '<br />' . "\n";
$output .= "\t\t\t" . $this->twist['name'] . "\n";
$output .= "\t\t" . '</td>' . "\n";

return $output;
Expand Down

0 comments on commit 50b3d00

Please sign in to comment.