some refactor
This commit is contained in:
parent
f215b4fe43
commit
d648d58628
3 changed files with 16 additions and 21 deletions
|
|
@ -85,7 +85,6 @@ class BlogPost
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function isPublished($flag = null)
|
||||
{
|
||||
if (null === $flag) {
|
||||
|
|
@ -94,5 +93,4 @@ class BlogPost
|
|||
|
||||
$this->_isPublished = (boolean)$flag;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
* User
|
||||
*
|
||||
*/
|
||||
class User
|
||||
class User extends Fiktiv_Model_Abstract
|
||||
{
|
||||
protected $_id = 0;
|
||||
protected $_email;
|
||||
|
|
@ -30,7 +30,6 @@ class User
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set user lastname
|
||||
*
|
||||
|
|
@ -47,7 +46,6 @@ class User
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set user firstname
|
||||
*
|
||||
|
|
@ -66,7 +64,6 @@ class User
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the user registration date
|
||||
*
|
||||
|
|
@ -90,7 +87,6 @@ class User
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the user registration date
|
||||
*
|
||||
|
|
@ -101,7 +97,6 @@ class User
|
|||
return !empty($_regDate) ? $_regDate : false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the current status of the account.
|
||||
*
|
||||
|
|
@ -112,19 +107,6 @@ class User
|
|||
return !$this->_isDeleted;
|
||||
}
|
||||
|
||||
|
||||
public function __call($name,$args) {
|
||||
|
||||
// getX methods
|
||||
if ('get' == substr($name,0,3)) {
|
||||
$dataPart = '_'.lcfirst(substr($name,3));
|
||||
if (isset($this->$dataPart))
|
||||
return $this->$dataPart;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* String representation of the object
|
||||
* @return string
|
||||
|
|
|
|||
15
library/Fiktiv/Model/Abstract.php
Normal file
15
library/Fiktiv/Model/Abstract.php
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
abstract class Fiktiv_Model_Abstract
|
||||
{
|
||||
|
||||
public function __call($name, $args) {
|
||||
|
||||
// getX methods
|
||||
if ('get' == substr($name,0,3)) {
|
||||
$property = substr($name, 3);
|
||||
$dataPart = '_' . strtolower($property[0]) . substr($property, 1);
|
||||
return isset($this->$dataPart) ? $this->$dataPart : false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in a new issue