diff --git a/module/VuFind/src/VuFind/Db/Table/UserStatsFields.php b/module/VuFind/src/VuFind/Db/Table/UserStatsFields.php index ade5407dc2d9d763794528d82d193c0e2183f192..c3412c51cd0083b7f001055bf36022c971c89aa8 100644 --- a/module/VuFind/src/VuFind/Db/Table/UserStatsFields.php +++ b/module/VuFind/src/VuFind/Db/Table/UserStatsFields.php @@ -106,7 +106,7 @@ class UserStatsFields extends Gateway array($fields[$i] => 'field'.$i.'.value') ); } - foreach ($values as $key=>$value) { + foreach ($values as $key=>$value) { $select->where->equalTo($key, $value); } }; diff --git a/module/VuFind/src/VuFind/Statistics/AbstractBase.php b/module/VuFind/src/VuFind/Statistics/AbstractBase.php index b23c1a45c416d58a50d45a41b43be14f61eac956..9bdd41f5466b32141b3e94383e236f31f94369e4 100644 --- a/module/VuFind/src/VuFind/Statistics/AbstractBase.php +++ b/module/VuFind/src/VuFind/Statistics/AbstractBase.php @@ -55,12 +55,25 @@ abstract class AbstractBase implements ServiceLocatorAwareInterface $this->drivers = self::getDriversForSource($source); } - // Set it - public function setServiceLocator(ServiceLocatorInterface $serviceLocator) { + /** + * Set the service locator. + * + * @param ServiceLocatorInterface $serviceLocator Locator to register + * + * @return Manager + */ + public function setServiceLocator(ServiceLocatorInterface $serviceLocator) + { $this->serviceLocator = $serviceLocator; } - // Get it - public function getServiceLocator() { + + /** + * Get the service locator. + * + * @return \Zend\ServiceManager\ServiceLocatorInterface + */ + public function getServiceLocator() + { return $this->serviceLocator; } @@ -156,19 +169,21 @@ abstract class AbstractBase implements ServiceLocatorAwareInterface */ protected function getUserData($request) { - $agent = $request->getServer()->get('HTTP_USER_AGENT'); + $server = $request->getServer(); + $agent = $server->get('HTTP_USER_AGENT'); list($browser, $version) = explode(' ', static::getBrowser($agent)); return array( 'id' => uniqid('', true), 'datestamp' => substr(date('c', strtotime('now')), 0, -6) . 'Z', 'browser' => $browser, 'browserVersion' => $version, - 'ipaddress' => $request->getServer()->get('REMOTE_ADDR'), - 'referrer' => ($request->getServer()->get('HTTP_REFERER') == null) + 'ipaddress' => $server->get('REMOTE_ADDR'), + 'referrer' => ($server->get('HTTP_REFERER') == null) ? 'Manual' - : $request->getServer()->get('HTTP_REFERER'), - 'url' => $request->getServer()->get('REQUEST_URI'), - 'session' => $this->getServiceLocator()->get('SessionManager')->getId() + : $server->get('HTTP_REFERER'), + 'url' => $server->get('REQUEST_URI'), + 'session' => + $this->getServiceLocator()->get('SessionManager')->getId() ); } diff --git a/module/VuFind/src/VuFind/Statistics/Driver/File.php b/module/VuFind/src/VuFind/Statistics/Driver/File.php index 61bb15f0ffb30914a9ffd0284916e7a9985ce0fd..6841428b1a9a400cf266ebf8ea7a233697a90033 100644 --- a/module/VuFind/src/VuFind/Statistics/Driver/File.php +++ b/module/VuFind/src/VuFind/Statistics/Driver/File.php @@ -54,7 +54,7 @@ class File extends AbstractBase $configs = ConfigReader::getConfig(); $this->folder = $configs->Statistics->file; // Use class name as file name - $parts = explode('\\',$source); + $parts = explode('\\', $source); $this->file = strToLower(end($parts)); }