Created
November 19, 2018 23:39
-
-
Save geoffroycochard/9ed9fd7a03d1cf782d1f264dc59c37f8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
namespace App\Data; | |
class Todo | |
{ | |
private $todos = [ | |
1 => [ | |
'title' => 'todo1', | |
'description' => 'description1' | |
], | |
2 => [ | |
'title' => 'todo2', | |
'description' => 'description2' | |
], | |
3 => [ | |
'title' => 'todo3', | |
'description' => 'description3' | |
], | |
]; | |
public function getAll() | |
{ | |
return $this->todos; | |
} | |
public function get($id) | |
{ | |
if (!array_key_exists($id, $this->todos)) { | |
return false; | |
} | |
return $this->todos[$id]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment