Seeder::__get()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
/**
3
 * 『CodeIgniter徹底入門』のサンプルアプリケーションをCodeIgniter 3.0にアップデート
4
 *
5
 * @author     Kenji Suzuki <https://github.com/kenjis>
6
 * @license    BSD 3-Clause License
7
 * @copyright  2015 Kenji Suzuki
8
 * @link       https://github.com/kenjis/codeigniter-tettei-apps
9
 */
10
11
class Seeder
12
{
13
	private $CI;
14
	protected $db;
15
	protected $dbforge;
16
17
	public function __construct()
18
	{
19
		$this->CI =& get_instance();
20
		$this->CI->load->database();
21
		$this->CI->load->dbforge();
22
		$this->db = $this->CI->db;
0 ignored issues
show
Bug introduced by
The property db does not seem to exist in CI_Controller.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
23
		$this->dbforge = $this->CI->dbforge;
0 ignored issues
show
Bug introduced by
The property dbforge does not seem to exist in CI_Controller.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
24
	}
25
26
	/**
27
	 * Run another seeder
28
	 * 
29
	 * @param string $seeder Seeder classname
30
	 */
31
	public function call($seeder)
32
	{
33
		$file = APPPATH . 'database/seeds/' . $seeder . '.php';
34
		require_once $file;
35
		$obj = new $seeder;
36
		$obj->run();
37
	}
38
39
	public function __get($property)
40
	{
41
		return $this->CI->$property;
42
	}
43
}
44