-
Notifications
You must be signed in to change notification settings - Fork 0
/
Abstract.php
56 lines (53 loc) · 1.28 KB
/
Abstract.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/**
* SocialEngine
*
* @category Application_Core
* @package Core
* @copyright Copyright 2006-2010 Webligo Developments
* @license http://www.socialengine.com/license/
* @version $Id: Abstract.php 9747 2012-07-26 02:08:08Z john $
* @author John
*/
/**
* @category Application_Core
* @package Core
* @copyright Copyright 2006-2010 Webligo Developments
* @license http://www.socialengine.com/license/
*/
abstract class Core_Model_Abstract
{
/**
* @var string The module name of this model (say that 12 times fast)
*/
protected $_moduleName;
/**
* Get the module this model belongs to
*
* @return string The module name of this model
*/
public function getModuleName()
{
if( empty($this->_moduleName) )
{
$class = get_class($this);
if (preg_match('/^([a-z][a-z0-9]*)_/i', $class, $matches)) {
$prefix = $matches[1];
} else {
$prefix = $class;
}
$this->_moduleName = $prefix;
}
return $this->_moduleName;
}
/**
* Magic caller
*
* @param string $method
* @param array $arguments
*/
public function __call($method, $arguments)
{
throw new Core_Model_Exception(sprintf('Unimplemented method %1$s in class %2$s', $method, get_class($this)));
}
}