Skip to content

Instantly share code, notes, and snippets.

@geoffroycochard
Created November 19, 2018 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geoffroycochard/9ed9fd7a03d1cf782d1f264dc59c37f8 to your computer and use it in GitHub Desktop.
Save geoffroycochard/9ed9fd7a03d1cf782d1f264dc59c37f8 to your computer and use it in GitHub Desktop.
<?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