Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
12 / 12 |
CRAP | |
100.00% |
23 / 23 |
Mongo | |
100.00% |
1 / 1 |
|
100.00% |
12 / 12 |
13 | |
100.00% |
23 / 23 |
buildConnection | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
buildParserInstance | |
100.00% |
1 / 1 |
1 | |
100.00% |
4 / 4 |
|||
buildParser | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
operatorParser | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
conditionsParser | |
100.00% |
1 / 1 |
2 | |
100.00% |
4 / 4 |
|||
queryBuilder | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
|||
buildConditions | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
buildConditionsParserInstance | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
|||
buildQuery | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
result | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
expandedGroup | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
runner | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
<?php | |
namespace PHPixie\Database\Driver; | |
class Mongo extends \PHPixie\Database\Driver | |
{ | |
protected $conditionsParser; | |
public function buildConnection($connectionName, $config) | |
{ | |
return new \PHPixie\Database\Driver\Mongo\Connection($this, $connectionName, $config); | |
} | |
public function buildParserInstance($connectionName) | |
{ | |
$connection = $this->database->get($connectionName); | |
$config = $connection->config(); | |
$conditionsParser = $this->conditionsParser(); | |
return $this->buildParser($config, $conditionsParser); | |
} | |
public function buildParser($config, $conditionsParser) | |
{ | |
return new \PHPixie\Database\Driver\Mongo\Parser($this->database, $this, $config, $conditionsParser); | |
} | |
public function operatorParser() | |
{ | |
return new \PHPixie\Database\Driver\Mongo\Parser\Operator; | |
} | |
public function conditionsParser() | |
{ | |
if($this->conditionsParser === null) { | |
$this->conditionsParser = $this->buildConditionsParserInstance(); | |
} | |
return $this->conditionsParser; | |
} | |
public function queryBuilder() | |
{ | |
$conditions = $this->conditions(); | |
$values = $this->database->values(); | |
return new \PHPixie\Database\Driver\Mongo\Query\Builder($conditions, $values); | |
} | |
public function buildConditions() | |
{ | |
return new \PHPixie\Database\Driver\Mongo\Conditions(); | |
} | |
public function buildConditionsParserInstance() | |
{ | |
$conditions = $this->conditions(); | |
$operatorParser = $this->operatorParser(); | |
return new \PHPixie\Database\Driver\Mongo\Parser\Conditions($this, $conditions, $operatorParser); | |
} | |
public function buildQuery($type, $connection, $parser, $builder) | |
{ | |
$class = '\PHPixie\Database\Driver\Mongo\Query\Type\\'.ucfirst($type); | |
return new $class($connection, $parser, $builder); | |
} | |
public function result($cursor) | |
{ | |
return new \PHPixie\Database\Driver\Mongo\Result($cursor); | |
} | |
public function expandedGroup($condition = null) | |
{ | |
return new \PHPixie\Database\Driver\Mongo\Parser\Conditions\ExpandedGroup($condition); | |
} | |
public function runner() | |
{ | |
return new \PHPixie\Database\Driver\Mongo\Query\Runner; | |
} | |
} |