/** * @param \RedDevil\Core\Identity\IdentityUserTable $anotherUserTable * @return bool */ public function equals($anotherUserTable) { foreach ($this->columns as $key => $value) { if (!$anotherUserTable->hasColumn($key)) { return false; } else { if ($value !== $anotherUserTable->getColumnType($key)) { return false; } } } return true; }
private static function getUserFromIdentitySystem() { $userTable = new IdentityUserTable(); $className = IdentityConfig::CURRENT_USER_MODEL; $userInstance = new $className(); $class = new ReflectionClass($userInstance); $methods = $class->getMethods(ReflectionMethod::IS_PUBLIC); foreach ($methods as $method) { if (strpos($method->getName(), 'get') === 0) { $columnName = substr($method->getName(), 3, strlen($method->getName())); $columnName = strtolower($columnName); $annotationsText = $method->getDocComment(); preg_match("/@type\\s+([\\w\\d\\(\\)]+)/", $annotationsText, $matches); $type = $matches[1]; $userTable->setColumn($columnName, $type); } } return $userTable; }