Browse Source

reduce nesting

ypnos-web 10 years ago
parent
commit
ab3f5d5a2f
1 changed files with 4 additions and 3 deletions
  1. 4 3
      src/Datasource/EntityTrait.php

+ 4 - 3
src/Datasource/EntityTrait.php

@@ -513,10 +513,11 @@ trait EntityTrait
             if (empty(static::$_accessors[$this->_className])) {
                 foreach (get_class_methods($this) as $m) {
                     $t = substr($m, 1, 3);
-                    if ($m[0] === '_' && in_array($t, ['get', 'set'])) {
-                        $p = Inflector::underscore(substr($m, 4));
-                        static::$_accessors[$this->_className][$t][$p] = $m;
+                    if ($m[0] !== '_' || !in_array($t, ['get', 'set'])) {
+                        continue;
                     }
+                    $p = Inflector::underscore(substr($m, 4));
+                    static::$_accessors[$this->_className][$t][$p] = $m;
                 }
             }
             /* if still not set, remember that the method indeed is not present */