Model_Core   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 2
Bugs 1 Features 0
Metric Value
c 2
b 1
f 0
dl 0
loc 19
rs 10
wmc 2
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
1
<?php defined('SYSPATH') or die('No direct access allowed.');
2
/**
3
 * Model base class.
4
 *
5
 * $Id: Model.php 4007 2009-02-20 01:54:00Z jheathco $
6
 *
7
 * @package    Core
8
 * @author     Kohana Team
9
 * @copyright  (c) 2007-2009 Kohana Team
10
 * @license    http://kohanaphp.com/license.html
11
 */
12
class Model_Core
13
{
14
15
    // Database object
16
    protected $db = 'default';
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $db. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
17
18
    /**
19
     * Loads the database instance, if the database is not already loaded.
20
     *
21
     * @return  void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
22
     */
23
    public function __construct()
24
    {
25
        if (! is_object($this->db)) {
26
            // Load the default database
27
            $this->db = Database::instance($this->db);
28
        }
29
    }
30
} // End Model
31