Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ clover.xml
coveralls-upload.json
phpunit.xml
.phpcs-cache
.phpunit.result.cache

# Created by .ignore support plugin (hsz.mobi)
### JetBrains template
Expand Down
5 changes: 0 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@
"Frontend\\User\\": "src/User/src/"
}
},
"autoload-dev": {
"psr-4": {
"AppTest\\": "test/AppTest/"
}
},
"scripts": {
"post-create-project-cmd": [
"@development-enable"
Expand Down
4 changes: 0 additions & 4 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,4 @@
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true">
<testsuites>
<testsuite name="UnitTests"/>
<testsuite name="FunctionalTests"/>
</testsuites>
</phpunit>
4 changes: 2 additions & 2 deletions src/App/src/Common/TimestampAwareTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ public function touch(): void
{
try {
$this->updated = new DateTimeImmutable();
} catch (Exception) {
#TODO save the error message
} catch (Exception $exception) {
error_log($exception->getMessage());
}
}
}
5 changes: 1 addition & 4 deletions src/App/src/Factory/AuthMiddlewareFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,10 @@ class AuthMiddlewareFactory
use AttachAuthorizationEventListenersTrait;

/**
* @param ContainerInterface $container
* @param $requestedName
* @return AuthMiddleware
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function __invoke(ContainerInterface $container, $requestedName): AuthMiddleware
public function __invoke(ContainerInterface $container, string $requestedName): AuthMiddleware
{
/** @var RbacGuardOptions $options */
$options = $container->get(RbacGuardOptions::class);
Expand Down
12 changes: 1 addition & 11 deletions src/App/src/RoutesDelegator.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,9 @@
use Mezzio\Application;
use Psr\Container\ContainerInterface;

/**
* Class RoutesDelegator
* @package Frontend\App
*/
class RoutesDelegator
{
/**
* @param ContainerInterface $container
* @param $serviceName
* @param callable $callback
* @return Application
*/
public function __invoke(ContainerInterface $container, $serviceName, callable $callback): Application
public function __invoke(ContainerInterface $container, string $serviceName, callable $callback): Application
{
/** @var Application $app */
$app = $callback();
Expand Down
19 changes: 1 addition & 18 deletions src/App/src/Service/CookieService.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ class CookieService implements CookieServiceInterface
private ConfigInterface $sessionConfig;

/**
* @param SessionManager $sessionManager
*
* @Inject({
* SessionManager::class
* })
Expand All @@ -31,13 +29,7 @@ public function __construct(SessionManager $sessionManager)
$this->sessionConfig = $sessionManager->getConfig();
}

/**
* @param string $name
* @param $value
* @param array|null $options
* @return bool
*/
public function setCookie(string $name, $value, ?array $options = []): bool
public function setCookie(string $name, mixed $value, ?array $options = []): bool
{
if (!$this->sessionConfig->getUseCookies()) {
return false;
Expand All @@ -46,10 +38,6 @@ public function setCookie(string $name, $value, ?array $options = []): bool
return setcookie($name, $value, $this->getMergedOptions($options));
}

/**
* @param string $name
* @return bool
*/
public function expireCookie(string $name): bool
{
return setcookie($name, '', $this->getMergedOptions([
Expand All @@ -58,8 +46,6 @@ public function expireCookie(string $name): bool
}

/**
* @param array|null $options
* @return array
* @psalm-suppress UndefinedInterfaceMethod
*/
private function getMergedOptions(?array $options = []): array
Expand All @@ -74,9 +60,6 @@ private function getMergedOptions(?array $options = []): array
];
}

/**
* @return int
*/
private function getCookieLifetime(): int
{
return time() + $this->sessionConfig->getCookieLifetime();
Expand Down
12 changes: 1 addition & 11 deletions src/App/src/Service/CookieServiceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,7 @@
*/
interface CookieServiceInterface
{
/**
* @param string $name
* @param $value
* @param array|null $options
* @return bool
*/
public function setCookie(string $name, $value, ?array $options = []): bool;
public function setCookie(string $name, mixed $value, ?array $options = []): bool;

/**
* @param string $name
* @return bool
*/
public function expireCookie(string $name): bool;
}
2 changes: 1 addition & 1 deletion src/App/src/Service/TranslateServiceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ interface TranslateServiceInterface
/**
* @param string $languageKey
*/
public function addTranslatorCookie(string $languageKey);
public function addTranslatorCookie(string $languageKey): void;
}
12 changes: 1 addition & 11 deletions src/Contact/src/RoutesDelegator.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,9 @@
use Mezzio\Application;
use Psr\Container\ContainerInterface;

/**
* Class RoutesDelegator
* @package Frontend\Contact
*/
class RoutesDelegator
{
/**
* @param ContainerInterface $container
* @param $serviceName
* @param callable $callback
* @return Application
*/
public function __invoke(ContainerInterface $container, $serviceName, callable $callback): Application
public function __invoke(ContainerInterface $container, string $serviceName, callable $callback): Application
{
/** @var Application $app */
$app = $callback();
Expand Down
31 changes: 1 addition & 30 deletions src/Contact/src/Service/MessageService.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ public function __construct(
$this->config = $config;
}

/**
* @return MessageRepository
*/
public function getRepository(): MessageRepository
public function getRepository(): MessageRepository|EntityRepository
{
return $this->repository;
}
Expand Down Expand Up @@ -100,30 +97,4 @@ public function sendContactMail(Message $message): bool

return $this->mailService->send()->isValid();
}

/**
* @param $response
* @return bool
*/
public function recaptchaIsValid($response): bool
{
$requestJson = [
'response' => $response,
'secret' => $this->config['recaptcha']['secretKey']
];
$url = 'https://www.google.com/recaptcha/api/siteverify';

$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POSTFIELDS, $requestJson);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

$checkRecaptchaResponse = curl_exec($curl);
$checkRecaptchaResponse = json_decode($checkRecaptchaResponse, true);
if ($checkRecaptchaResponse['success']) {
return true;
}
return false;
}
}
12 changes: 2 additions & 10 deletions src/Contact/src/Service/MessageServiceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Frontend\Contact\Service;

use Doctrine\ORM\EntityRepository;
use Dot\Mail\Exception\MailException;
use Frontend\Contact\Entity\Message;
use Frontend\Contact\Repository\MessageRepository;
Expand All @@ -14,10 +15,7 @@
*/
interface MessageServiceInterface
{
/**
* @return MessageRepository
*/
public function getRepository(): MessageRepository;
public function getRepository(): MessageRepository|EntityRepository;

/**
* @param array $data
Expand All @@ -31,10 +29,4 @@ public function processMessage(array $data): bool;
* @throws MailException
*/
public function sendContactMail(Message $message): bool;

/**
* @param $response
* @return bool
*/
public function recaptchaIsValid($response): bool;
}
12 changes: 1 addition & 11 deletions src/Page/src/RoutesDelegator.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,9 @@
use Mezzio\Application;
use Psr\Container\ContainerInterface;

/**
* Class RoutesDelegator
* @package Frontend\Page
*/
class RoutesDelegator
{
/**
* @param ContainerInterface $container
* @param $serviceName
* @param callable $callback
* @return Application
*/
public function __invoke(ContainerInterface $container, $serviceName, callable $callback): Application
public function __invoke(ContainerInterface $container, string $serviceName, callable $callback): Application
{
/** @var Application $app */
$app = $callback();
Expand Down
14 changes: 4 additions & 10 deletions src/Plugin/src/Factory/PluginManagerAwareInitializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,18 @@
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;

/**
* Class PluginManagerAwareInitializer
* @package Frontend\Plugin\Factory
*/
class PluginManagerAwareInitializer
{
/**
* @param ContainerInterface $container
* @param $instance
* @return void
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function __invoke(ContainerInterface $container, $instance): void
public function __invoke(ContainerInterface $container, ?object $instance): void
{
if ($instance instanceof PluginManagerAwareInterface) {
$pluginManager = $container->get(PluginManager::class);
$instance->setPluginManager($pluginManager);
$instance->setPluginManager(
$container->get(PluginManager::class)
);
}
}
}
2 changes: 1 addition & 1 deletion src/Plugin/src/TemplatePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function render(string $templateName, array $params = []): string
* @param string $param
* @param mixed $value
*/
public function addDefaultParam(string $templateName, string $param, mixed $value)
public function addDefaultParam(string $templateName, string $param, mixed $value): void
{
$this->template->addDefaultParam($templateName, $param, $value);
}
Expand Down
7 changes: 3 additions & 4 deletions src/User/src/Adapter/AuthenticationAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Exception;
use Frontend\User\Entity\User;
use Frontend\User\Entity\UserIdentity;
use Frontend\User\Entity\UserInterface;
use Frontend\User\Entity\UserRole;
use Laminas\Authentication\Adapter\AbstractAdapter;
use Laminas\Authentication\Adapter\AdapterInterface;
Expand Down Expand Up @@ -124,7 +125,7 @@ public function authenticate(): Result
/**
* @throws Exception
*/
private function validateConfig()
private function validateConfig(): void
{
if (!isset($this->config['identity_class']) || !class_exists($this->config['identity_class'])) {
throw new Exception("Missing or invalid param 'identity_class' provided.");
Expand All @@ -144,11 +145,9 @@ private function validateConfig()
}

/**
* @param $identityClass
* @param string $methodName
* @throws Exception
*/
private function checkMethod($identityClass, string $methodName): void
private function checkMethod(UserInterface $identityClass, string $methodName): void
{
if (!method_exists($identityClass, $methodName)) {
throw new Exception(sprintf(
Expand Down
4 changes: 2 additions & 2 deletions src/User/src/Entity/UserAvatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ public function getName(): string
}

/**
* @param $name
* @param string $name
* @return self
*/
public function setName($name): self
public function setName(string $name): self
{
$this->name = $name;

Expand Down
8 changes: 4 additions & 4 deletions src/User/src/Entity/UserDetail.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ public function getFirstName(): ?string
}

/**
* @param $firstName
* @param string $firstName
* @return self
*/
public function setFirstName($firstName): self
public function setFirstName(string $firstName): self
{
$this->firstName = $firstName;

Expand All @@ -87,10 +87,10 @@ public function getLastName(): ?string
}

/**
* @param $lastName
* @param string $lastName
* @return self
*/
public function setLastName($lastName): self
public function setLastName(string $lastName): self
{
$this->lastName = $lastName;

Expand Down
4 changes: 2 additions & 2 deletions src/User/src/Entity/UserResetPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ public function getHash(): string
}

/**
* @param $hash
* @param string $hash
* @return self
*/
public function setHash($hash): self
public function setHash(string $hash): self
{
$this->hash = $hash;

Expand Down
Loading