Skip to content

Commit

Permalink
Latest
Browse files Browse the repository at this point in the history
  • Loading branch information
susanBuck committed Oct 25, 2021
1 parent d24fcee commit 1a9b15c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vendor
composer.lock
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
An example package used to demonstrate dependencies in [DGMD E-2 Web Programming for Beginners with PHP](https://hesweb.dev/e2).



## Installation
```php
composer require susanbuck/rock-paper-scissors
Expand Down
7 changes: 4 additions & 3 deletions src/Game.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class Game
private $maxResults;
private $sessionKey = 'RPS_Results';


/**
* __construct
*
Expand All @@ -31,7 +30,7 @@ public function __construct(bool $persistResults = false, int $maxResults = 5, s
}
}


/**
* play
* Invoke with a move: rock, paper or scissors
Expand Down Expand Up @@ -70,6 +69,8 @@ public function play(string $move)
return $results;
}



/**
* getResults
* Retrieve the results from the session
Expand Down Expand Up @@ -134,4 +135,4 @@ private function getRandomMove()
{
return ['rock','paper','scissors'][rand(0, 1)];
}
}
}
6 changes: 2 additions & 4 deletions tests/index.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<?php

require $_SERVER['DOCUMENT_ROOT'].'/src/Game.php';
require $_SERVER['DOCUMENT_ROOT'].'/../src/Game.php';

$game = new RPS\Game(true);

$game->play('rock');



var_dump($game->getResults());
var_dump($game->getResults());

0 comments on commit 1a9b15c

Please sign in to comment.