diff --git a/phpunit.xml b/phpunit.xml index 8f4b58c..39c5df8 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,7 +1,7 @@ diff --git a/src/User.php b/src/User.php new file mode 100644 index 0000000..854d30d --- /dev/null +++ b/src/User.php @@ -0,0 +1,48 @@ +age = $age; + $this->name = $name; + } + + public function tellName(): string + { + return "My name is " . $this->name . "."; + } + + public function tellAge(): string + { + return "I am " . $this->age . " years old."; + } + + public function addFavoriteMovie(string $movie): bool + { + $this->favorite_movies[] = $movie; + + return true; + } + + public function removeFavoriteMovie(string $movie): bool + { + if (!in_array($movie, $this->favorite_movies)) throw new InvalidArgumentException("Unknown movie: " . $movie); + + unset($this->favorite_movies[array_search($movie, $this->favorite_movies)]); + + return true; + } +} diff --git a/src/autoload.php b/src/autoload.php new file mode 100644 index 0000000..43e515f --- /dev/null +++ b/src/autoload.php @@ -0,0 +1,3 @@ +