Common   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __call() 0 12 2
A dialectSettings() 0 7 1
1
<?php
2
/**
3
 * Phossa Project
4
 *
5
 * PHP version 5.4
6
 *
7
 * @category  Library
8
 * @package   Phossa2\Query
9
 * @copyright Copyright (c) 2016 phossa.com
10
 * @license   http://mit-license.org/ MIT License
11
 * @link      http://www.phossa.com/
12
 */
13
/*# declare(strict_types=1); */
14
15
namespace Phossa2\Query\Dialect;
16
17
use Phossa2\Query\Message\Message;
18
use Phossa2\Shared\Base\ObjectAbstract;
19
use Phossa2\Query\Interfaces\DialectInterface;
20
use Phossa2\Query\Exception\BadMethodCallException;
21
22
/**
23
 * Common
24
 *
25
 * Common dialect
26
 *
27
 * @package Phossa2\Query
28
 * @author  Hong Zhang <[email protected]>
29
 * @see     ObjectAbstract
30
 * @see     DialectInterface
31
 * @version 2.0.0
32
 * @since   2.0.0 added
33
 */
34
class Common extends ObjectAbstract implements DialectInterface
35
{
36
    public function __call(/*# string */ $method, array $params)
37
    {
38
        $class = $this->getClassName() . '\\' . ucfirst(strtolower($method));
39
        if (class_exists($class)) {
40
            return new $class($params[0]);
41
        }
42
43
        throw new BadMethodCallException(
44
            Message::get(Message::MSG_METHOD_NOTFOUND, $method, $this),
45
            Message::MSG_METHOD_NOTFOUND
46
        );
47
    }
48
49
    /**
50
     * {@inheritDoc}
51
     */
52
    public function dialectSettings()/*# : array */
53
    {
54
        return [
55
            'quotePrefix' => '"',
56
            'quoteSuffix' => '"'
57
        ];
58
    }
59
}
60