aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/AppFramework/Db
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2019-10-22 14:54:21 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2019-10-22 14:54:21 +0200
commitce9a434fb29ae34fbf998ea538d33dbaf4c28d72 (patch)
treea2ea0189deb663e75a137c1dfb547289c015b35b /lib/public/AppFramework/Db
parentac1585b316aa36c86f4265597bf9d970c61efdf7 (diff)
downloadnextcloud-server-ce9a434fb29ae34fbf998ea538d33dbaf4c28d72.tar.gz
nextcloud-server-ce9a434fb29ae34fbf998ea538d33dbaf4c28d72.zip
Add isXXX getter to Entity
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/public/AppFramework/Db')
-rw-r--r--lib/public/AppFramework/Db/Entity.php21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/public/AppFramework/Db/Entity.php b/lib/public/AppFramework/Db/Entity.php
index e339707d85f..091b90257b4 100644
--- a/lib/public/AppFramework/Db/Entity.php
+++ b/lib/public/AppFramework/Db/Entity.php
@@ -24,6 +24,9 @@
namespace OCP\AppFramework\Db;
+use function lcfirst;
+use function substr;
+
/**
* @method integer getId()
* @method void setId(integer $id)
@@ -139,16 +142,16 @@ abstract class Entity {
* getter method
* @since 7.0.0
*/
- public function __call($methodName, $args){
- $attr = lcfirst( substr($methodName, 3) );
-
- if(strpos($methodName, 'set') === 0){
- $this->setter($attr, $args);
- } elseif(strpos($methodName, 'get') === 0) {
- return $this->getter($attr);
+ public function __call($methodName, $args) {
+ if (strpos($methodName, 'set') === 0) {
+ $this->setter(lcfirst(substr($methodName, 3)), $args);
+ } elseif (strpos($methodName, 'get') === 0) {
+ return $this->getter(lcfirst(substr($methodName, 3)));
+ } elseif (strpos($methodName, 'is') === 0) {
+ return $this->getter(lcfirst(substr($methodName, 2)));
} else {
- throw new \BadFunctionCallException($methodName .
- ' does not exist');
+ throw new \BadFunctionCallException($methodName .
+ ' does not exist');
}
}