Skip to content

Commit

Permalink
Merge f39df66 into 82bf6e4
Browse files Browse the repository at this point in the history
  • Loading branch information
scrutinizer-auto-fixer committed Mar 20, 2017
2 parents 82bf6e4 + f39df66 commit c247dc3
Show file tree
Hide file tree
Showing 20 changed files with 98 additions and 99 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function formAction()
$application->getComments()->add($comment);
$application->changeStatus($application->getStatus(), sprintf(
/* @translate */ 'Application was rated by %s',
$this->auth()->getUser()->getInfo()->getDisplayName())
$this->auth()->getUser()->getInfo()->getDisplayName())
);
}
$viewModel->setVariable('isSaved', true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public function getSubscriber();
/**
* Gets all comments for the application.
*
* @return ArrayCollection;
* @return Collection
*/
public function getComments();
Expand Down Expand Up @@ -271,7 +271,7 @@ public function getRating($recalculate = false);
/**
* Gets all attributes for an application.
*
* @return ArrayCollection;
* @return Attributes
*/
public function getAttributes();
Expand Down
10 changes: 5 additions & 5 deletions module/Applications/src/Applications/Repository/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ public function getPaginationList($params)
{
$qb = $this->getPaginationQueryBuilder($params);
$cursor = $qb->hydrate(false)
->select('_id')
->getQuery()
->execute();
->select('_id')
->getQuery()
->execute();

$list = new PaginationList(array_keys(ArrayUtils::iteratorToArray($cursor)));
return $list;
Expand Down Expand Up @@ -133,8 +133,8 @@ public function loadUnreadApplicationsForJob($job)
{
$auth=$this->getService('AuthenticationService');
$qb=$this->createQueryBuilder()
->field("readBy")->notIn(array($auth->getUser()->getId()))
->field("job")->equals(new \MongoId($job->getId()));
->field("readBy")->notIn(array($auth->getUser()->getId()))
->field("job")->equals(new \MongoId($job->getId()));
return $qb->getQuery()->execute();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public function onFlush(OnFlushEventArgs $eventArgs)

foreach ($document->getAttachments() as $attachment) { /* @var \Applications\Entity\Attachment $attachment */
$attachment->getPermissions()
->clear()
->inherit($permissions);
->clear()
->inherit($permissions);
if ($isUpdate) {
$uow->computeChangeSet(
$dm->getClassMetadata(get_class($attachment)),
Expand All @@ -68,8 +68,8 @@ public function onFlush(OnFlushEventArgs $eventArgs)

if ($image = $document->getContact()->getImage()) {
$image->getPermissions()
->clear()
->inherit($permissions);
->clear()
->inherit($permissions);
if ($isUpdate) {
$uow->computeChangeSet(
$dm->getClassMetadata(get_class($image)),
Expand Down
68 changes: 34 additions & 34 deletions module/Auth/src/Auth/Controller/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
class IndexController extends AbstractActionController
{

const LOGIN='login';
const REGISTER='register';
const LOGIN = 'login';
const REGISTER = 'register';

/**
* @var AuthenticationService
Expand Down Expand Up @@ -91,7 +91,7 @@ public function indexAction()
$registerForm = $this->forms[self::REGISTER];

/* @var $request \Zend\Http\Request */
$request = $this->getRequest();
$request = $this->getRequest();

if ($request->isPost()) {
$data = $this->params()->fromPost();
Expand All @@ -109,7 +109,7 @@ public function indexAction()
if (array_key_exists('credentials', $data) &&
array_key_exists('login', $data['credentials']) &&
array_key_exists('credential', $data['credentials'])) {
$adapter->setIdentity($data['credentials']['login'] . $loginSuffix)
$adapter->setIdentity($data['credentials']['login'].$loginSuffix)
->setCredential($data['credentials']['credential']);
}

Expand All @@ -120,14 +120,14 @@ public function indexAction()
if ($result->isValid()) {
$user = $auth->getUser();
$language = $services->get('Core/Locale')->detectLanguage($request, $user);
$this->logger->info('User ' . $user->getLogin() . ' logged in');
$this->logger->info('User '.$user->getLogin().' logged in');

$ref = $this->params()->fromQuery('ref', false);

if ($ref) {
$ref = urldecode($ref);
$url = preg_replace('~/[a-z]{2}(/|$)~', '/' . $language . '$1', $ref);
$url = $request->getBasePath() . $url;
$url = preg_replace('~/[a-z]{2}(/|$)~', '/'.$language.'$1', $ref);
$url = $request->getBasePath().$url;
} else {
$urlHelper = $services->get('ViewHelperManager')->get('url');
$url = $urlHelper('lang', array('lang' => $language));
Expand All @@ -137,9 +137,9 @@ public function indexAction()
} else {
$loginName = $data['credentials']['login'];
if (!empty($loginSuffix)) {
$loginName = $loginName . ' (' . $loginName . $loginSuffix . ')';
$loginName = $loginName.' ('.$loginName.$loginSuffix.')';
}
$this->logger->info('Failed to authenticate User ' . $loginName);
$this->logger->info('Failed to authenticate User '.$loginName);
$this->notification()->danger(/*@translate*/ 'Authentication failed.');
}
}
Expand Down Expand Up @@ -198,11 +198,11 @@ public function loginAction()
try {
$user = $auth->getUser();
$password = substr(md5(uniqid()), 0, 6);
$login = uniqid() . ($this->options->auth_suffix != "" ? '@' . $this->options->auth_suffix : '');
$externalLogin = isset($user->login)?$user->login:'-- not communicated --';
$this->logger->debug('first login via ' . $provider . ' as: ' . $externalLogin);
$login = uniqid().($this->options->auth_suffix != "" ? '@'.$this->options->auth_suffix : '');
$externalLogin = isset($user->login) ? $user->login : '-- not communicated --';
$this->logger->debug('first login via '.$provider.' as: '.$externalLogin);

$user->login=$login;
$user->login = $login;
$user->setPassword($password);
$user->setRole($this->options->getRole());

Expand All @@ -219,11 +219,11 @@ public function loginAction()
);
$mail->addTo($user->getInfo()->getEmail());

$loggerId = $login . ' (' . $provider . ': ' . $externalLogin . ')';
$loggerId = $login.' ('.$provider.': '.$externalLogin.')';
if (isset($mail) && $this->mailer($mail)) {
$this->logger->info('Mail first-login for ' . $loggerId . ' sent to ' . $user->getInfo()->getEmail());
$this->logger->info('Mail first-login for '.$loggerId.' sent to '.$user->getInfo()->getEmail());
} else {
$this->logger->warn('No Mail was sent for ' . $loggerId);
$this->logger->warn('No Mail was sent for '.$loggerId);
}
} catch (\Exception $e) {
$this->logger->crit($e);
Expand All @@ -234,11 +234,11 @@ public function loginAction()
}

$user = $auth->getUser();
$this->logger->info('User ' . $auth->getUser()->getInfo()->getDisplayName() . ' logged in via ' . $provider);
$this->logger->info('User '.$auth->getUser()->getInfo()->getDisplayName().' logged in via '.$provider);
$settings = $user->getSettings('Core');
if (null !== $settings->localization->language) {
$basePath = $this->getRequest()->getBasePath();
$ref = preg_replace('~^'.$basePath . '/[a-z]{2}(?=/|$)~', $basePath . '/' . $settings->localization->language, $ref);
$ref = preg_replace('~^'.$basePath.'/[a-z]{2}(?=/|$)~', $basePath.'/'.$settings->localization->language, $ref);
}
return $this->redirect()->toUrl($ref);
}
Expand Down Expand Up @@ -270,8 +270,8 @@ public function loginExternAction()

if ($result->isValid()) {
$this->logger->info(
'User ' . $this->params()->fromPost('user') .
' logged via ' . $appKey
'User '.$this->params()->fromPost('user').
' logged via '.$appKey
);

// the external login may include some parameters for an update
Expand Down Expand Up @@ -302,7 +302,7 @@ public function loginExternAction()
if (array_key_exists('firstLogin', $resultMessage) && $resultMessage['firstLogin'] === true) {
// first external Login
$userName = $this->params()->fromPost('user');
$this->logger->debug('first login for User: ' . $userName);
$this->logger->debug('first login for User: '.$userName);
//
if (preg_match('/^(.*)@\w+$/', $userName, $realUserName)) {
$userName = $realUserName[1];
Expand All @@ -326,7 +326,7 @@ public function loginExternAction()

try {
$this->mailer($mail);
$this->logger->info('Mail first-login sent to ' . $userName);
$this->logger->info('Mail first-login sent to '.$userName);
} catch (\Zend\Mail\Transport\Exception\ExceptionInterface $e) {
$this->logger->warn('No Mail was sent');
$this->logger->debug($e);
Expand All @@ -341,8 +341,8 @@ public function loginExternAction()
);
} else {
$this->logger->info(
'Failed to authenticate User ' . $this->params()->fromPost('user') .
' via ' . $this->params()->fromPost('appKey')
'Failed to authenticate User '.$this->params()->fromPost('user').
' via '.$this->params()->fromPost('appKey')
);

$this->getResponse()->setStatusCode(Response::STATUS_CODE_401);
Expand All @@ -367,8 +367,8 @@ public function groupAction()
array(
'format' => 'json',
'group' => array(
0 => 'testuser4711', 1 => 'flatscreen', 2 => 'flatscreen1', 3 => 'flatscreen2', 4 => 'flatscreen3', 5 => 'flatscreen4',
6 => 'flatscreen5', 7 => 'flatscreen6', 8 => 'flatscreen7', 9 => 'flatscreen8', 10 => 'flatscreen9'
0 => 'testuser4711', 1 => 'flatscreen', 2 => 'flatscreen1', 3 => 'flatscreen2', 4 => 'flatscreen3', 5 => 'flatscreen4',
6 => 'flatscreen5', 7 => 'flatscreen6', 8 => 'flatscreen7', 9 => 'flatscreen8', 10 => 'flatscreen9'
),
'name' => '(die) Rauscher – Unternehmensberatung & Consulting',
)
Expand All @@ -377,7 +377,7 @@ public function groupAction()
}
$auth = $this->auth;
$userGrpAdmin = $auth->getUser();
$this->logger->info('User ' . $auth->getUser()->getInfo()->getDisplayName());
$this->logger->info('User '.$auth->getUser()->getInfo()->getDisplayName());
$grp = $this->params()->fromQuery('group');

// if the request is made by an external host, add his identification-key to the name
Expand All @@ -398,16 +398,16 @@ public function groupAction()
foreach ($params->group as $grp_member) {
try
{
$user = $users->findByLogin($grp_member . $loginSuffix);
$user = $users->findByLogin($grp_member.$loginSuffix);
if (!empty($user)) {
$groupUserId[] = $user->id;
} else {
$notFoundUsers[] = $grp_member . $loginSuffix;
$notFoundUsers[] = $grp_member.$loginSuffix;
}
}
catch (\Auth\Exception\UserDeactivatedException $e)
{
$notFoundUsers[] = $grp_member . $loginSuffix;
$notFoundUsers[] = $grp_member.$loginSuffix;
}
}
}
Expand All @@ -417,9 +417,9 @@ public function groupAction()
$group->setUsers($groupUserId);
}
$this->logger->info(
'Update Group Name: ' . $name . PHP_EOL . str_repeat(' ', 36) . 'Group Owner: ' . $userGrpAdmin->getLogin() . PHP_EOL .
str_repeat(' ', 36) . 'Group Members Param: ' . implode(',', $params->group) . PHP_EOL .
str_repeat(' ', 36) . 'Group Members: ' . count($groupUserId) . PHP_EOL . str_repeat(' ', 36) . 'Group Members not found: ' . implode(',', $notFoundUsers)
'Update Group Name: '.$name.PHP_EOL.str_repeat(' ', 36).'Group Owner: '.$userGrpAdmin->getLogin().PHP_EOL.
str_repeat(' ', 36).'Group Members Param: '.implode(',', $params->group).PHP_EOL.
str_repeat(' ', 36).'Group Members: '.count($groupUserId).PHP_EOL.str_repeat(' ', 36).'Group Members not found: '.implode(',', $notFoundUsers)
);

return new JsonModel(
Expand All @@ -436,7 +436,7 @@ public function groupAction()
public function logoutAction()
{
$auth = $this->auth;
$this->logger->info('User ' . ($auth->getUser()->getLogin()==''?$auth->getUser()->getInfo()->getDisplayName():$auth->getUser()->getLogin()) . ' logged out');
$this->logger->info('User '.($auth->getUser()->getLogin() == '' ? $auth->getUser()->getInfo()->getDisplayName() : $auth->getUser()->getLogin()).' logged out');
$auth->clearIdentity();
unset($_SESSION['HA::STORE']);

Expand Down
2 changes: 1 addition & 1 deletion module/Auth/src/Auth/Controller/Plugin/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function get($property)
}
return $value;
}
return 'id' == $property ? $auth->getIdentity() : $auth->getUser()->{'get' . $property}();
return 'id' == $property ? $auth->getIdentity() : $auth->getUser()->{'get'.$property}();
}
return null;
}
Expand Down
4 changes: 2 additions & 2 deletions module/Auth/src/Auth/View/Helper/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ public function __invoke($property = null)
$value = null;
$service = $this->getService();
$user = $service->getUser();
if (method_exists($user,"get".$property)) {
$value = $user->{"get" . $property}();
if (method_exists($user, "get".$property)) {
$value = $user->{"get".$property}();
}
return $value;
} catch (\OutOfBoundsException $e) {
Expand Down
4 changes: 2 additions & 2 deletions module/Core/src/Core/Form/Element/FileUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function setIsMultiple($flag)

public function prepareElement(FormInterface $form)
{
$form->setAttribute('class', ($this->isMultiple() ? 'multi' : 'single') . '-file-upload');
$form->setAttribute('class', ($this->isMultiple() ? 'multi' : 'single').'-file-upload');
$form->setAttribute('data-is-empty', null === $this->getValue());
parent::prepareElement($form);
}
Expand Down Expand Up @@ -247,7 +247,7 @@ public function getFileEntity()
$entityName = $this->getName();

try {
$fileEntity = $object->{"get" . $entityName}();
$fileEntity = $object->{"get".$entityName}();
} catch (\OutOfBoundsException $e) {
return null;
}
Expand Down
4 changes: 2 additions & 2 deletions module/Core/src/Core/Form/RatingFieldset.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ public function build()
$properties = $refl->getProperties();

foreach ($properties as $property) {
$name = $property->getName();
$name = $property->getName();
if ('_' == $name{0}) {
continue;
}
$value = $rating->{'get' . $name}();
$value = $rating->{'get'.$name}();
$input = array(
'type' => 'Core/Rating',
'name' => $name,
Expand Down
6 changes: 3 additions & 3 deletions module/Core/src/Core/Repository/Filter/PropertyToKeywords.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function filter($value)
$entity = $value;
$value = array();
foreach ($entity->getSearchableProperties() as $name) {
$result = $entity->{'get' .$name}();
$result = $entity->{'get'.$name}();
if (is_array($result)) {
$value = array_merge($value, $result);
} else {
Expand All @@ -48,8 +48,8 @@ protected function getKeywords($string)
$innerPattern = StringUtils::hasPcreUnicodeSupport()
? '[^\p{L}]'
: '[^a-z0-9ßäöü ]';
$pattern = '~' . $innerPattern . '~isu';
$stripPattern = '~^' . $innerPattern . '+|' . $innerPattern . '+$~isu';
$pattern = '~'.$innerPattern.'~isu';
$stripPattern = '~^'.$innerPattern.'+|'.$innerPattern.'+$~isu';
$parts = array();
$textParts = explode(' ', $string);
foreach ($textParts as $part) {
Expand Down
8 changes: 4 additions & 4 deletions module/Core/src/Core/View/Helper/Period.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ class Period extends AbstractHelper
* returns the number of years of the education or work experience
*
* @param array $array
* @return string
* @return double
*/
public function __invoke($array)
{
// calculate EndDate - StartDate = X Years.
// eg. 4.2 Years

$days=0;
$days = 0;
foreach ($array as $obj) {
$date1 = new \DateTime($obj->getEndDate());
$date2 = new \DateTime($obj->getStartDate());
$interval = $date1->diff($date2);
$days+=abs($interval->format('%R%a'));
$days += abs($interval->format('%R%a'));
}
return round($days/365, 1);
return round($days / 365, 1);
}
}
2 changes: 1 addition & 1 deletion module/Cv/src/Cv/Entity/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ class Attachment extends FileEntity
*/
public function getUri()
{
return "/file/Cv.Attachment/" . $this->getId() . "/" .urlencode($this->name);
return "/file/Cv.Attachment/".$this->getId()."/".urlencode($this->name);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public function postRemoveEntity(LifecycleEventArgs $eventArgs)
$fileId = new \MongoId($file->getId());
$dm = $eventArgs->getDocumentManager();
$dm->createQueryBuilder('Cv\Entity\Cv')
->update()->multiple(true)
->field('attachments')->equals($fileId)->pull($fileId)
->getQuery()->execute();
->update()->multiple(true)
->field('attachments')->equals($fileId)->pull($fileId)
->getQuery()->execute();
}
}
Loading

0 comments on commit c247dc3

Please sign in to comment.