Skip to content

Commit

Permalink
issue #35 Добавил модель квеста и точки (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
iMega authored Sep 19, 2016
1 parent 21d144e commit 469f054
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
'user.mapper' => function (Application $app) {
return new \Kubikvest\Mapper\User($app['pdo'], $app['queryBuilder']);
},
'quest.mapper' => function (Application $app) {
return new \Kubikvest\Mapper\QuestMapper($app['quest']);
},
'tasks' => [
0 => [
[
Expand Down
38 changes: 38 additions & 0 deletions src/Kubikvest/Mapper/QuestMapper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

namespace Kubikvest\Mapper;

use Kubikvest\Model\Quest;

/**
* Class Quest
* @package Kubikvest\Mapper
*/
class QuestMapper
{
protected $db;
/**
* @param $db
*/
public function __construct(array $db)
{
$this->db = $db;
}

/**
* @param $id
*
* @return Quest
*/
public function getQuest($id)
{
$quest = new Quest();

$quest->questId = $this->db[$id]['id'];
$quest->title = $this->db[$id]['title'];
$quest->description = $this->db[$id]['description'];

$point = new Point();
$quest->currentPoint = $point;
}
}
18 changes: 18 additions & 0 deletions src/Kubikvest/Model/Quest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Kubikvest\Model;

class Quest
{
public $questId = null;
public $title = null;
public $description = null;

/**
* @return bool
*/
public function isEmpty()
{
return null === $this->questId;
}
}

0 comments on commit 469f054

Please sign in to comment.