Conditions | 5 |
Paths | 16 |
Total Lines | 28 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
31 | public function __construct(array $params = [], \Log $logger = null, \DB\SQL $db = null) |
||
32 | { |
||
33 | $f3 = \Base::instance(); |
||
34 | |||
35 | if (is_object($logger)) { |
||
36 | \Registry::set('logger', $logger); |
||
37 | } |
||
38 | $this->logObject = \Registry::get('logger'); |
||
39 | |||
40 | if (is_object($db)) { |
||
41 | \Registry::set('db', $db); |
||
42 | } |
||
43 | $this->db = \Registry::get('db'); |
||
44 | |||
45 | // guess the table name from the class name if not specified as a class member |
||
46 | $class = strrchr(get_class($this), '\\'); |
||
47 | $class = \UTF::instance()->substr($class, 1); |
||
48 | if (empty($this->table)) { |
||
49 | $table = $f3->snakecase($class); |
||
50 | } else { |
||
51 | $table = $this->table; |
||
52 | } |
||
53 | $this->table = $table; |
||
54 | |||
55 | foreach ($params as $k => $v) { |
||
56 | $this->$k = $v; |
||
57 | } |
||
58 | } |
||
59 | } |
||
60 |