Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/password_policy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-02-26 23:49:40 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2018-02-26 23:49:40 +0300
commitfc4f77052cc248b4e68f0e9fb0d381ab7faf28ad (patch)
treea4deb9caa50c8918afa1fa860c7ad939fe392edc /lib
parent98aab5ba04d6f7f1e3277ebac0f48dc38a511570 (diff)
Make the app strict
* Add typehints Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib')
-rw-r--r--lib/AppInfo/Application.php1
-rw-r--r--lib/Capabilities.php3
-rw-r--r--lib/PasswordPolicyConfig.php23
-rw-r--r--lib/PasswordValidator.php1
-rw-r--r--lib/Settings.php7
5 files changed, 20 insertions, 15 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index 96512d2..3659ea0 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright 2017, Roeland Jago Douma <roeland@famdouma.nl>
*
diff --git a/lib/Capabilities.php b/lib/Capabilities.php
index 8f4dd91..d2cfe18 100644
--- a/lib/Capabilities.php
+++ b/lib/Capabilities.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Bjoern Schiessle <bjoern@schiessle.org>
*
@@ -40,7 +41,7 @@ class Capabilities implements ICapability {
* @return array Array containing the apps capabilities
* @since 12.0.0
*/
- public function getCapabilities() {
+ public function getCapabilities(): array {
return [
'password_policy' =>
[
diff --git a/lib/PasswordPolicyConfig.php b/lib/PasswordPolicyConfig.php
index fbc88ff..725537a 100644
--- a/lib/PasswordPolicyConfig.php
+++ b/lib/PasswordPolicyConfig.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Bjoern Schiessle <bjoern@schiessle.org>
*
@@ -51,7 +52,7 @@ class PasswordPolicyConfig {
*
* @return int
*/
- public function getMinLength() {
+ public function getMinLength(): int {
$minLength = $this->config->getAppValue('password_policy', 'minLength', '8');
return (int)$minLength;
}
@@ -61,7 +62,7 @@ class PasswordPolicyConfig {
*
* @return bool
*/
- public function getEnforceNonCommonPassword() {
+ public function getEnforceNonCommonPassword(): bool {
$enforceNonCommonPasswords = $this->config->getAppValue(
'password_policy',
'enforceNonCommonPassword',
@@ -75,7 +76,7 @@ class PasswordPolicyConfig {
*
* @return bool
*/
- public function getEnforceUpperLowerCase() {
+ public function getEnforceUpperLowerCase(): bool {
$enforceUpperLowerCase = $this->config->getAppValue(
'password_policy',
'enforceUpperLowerCase',
@@ -90,7 +91,7 @@ class PasswordPolicyConfig {
*
* @return bool
*/
- public function getEnforceNumericCharacters() {
+ public function getEnforceNumericCharacters(): bool {
$enforceNumericCharacters = $this->config->getAppValue(
'password_policy',
'enforceNumericCharacters',
@@ -105,7 +106,7 @@ class PasswordPolicyConfig {
*
* @return bool
*/
- public function getEnforceSpecialCharacters() {
+ public function getEnforceSpecialCharacters(): bool {
$enforceSpecialCharacters = $this->config->getAppValue(
'password_policy',
'enforceSpecialCharacters',
@@ -120,7 +121,7 @@ class PasswordPolicyConfig {
*
* @param int $minLength
*/
- public function setMinLength($minLength) {
+ public function setMinLength(int $minLength) {
$this->config->setAppValue('password_policy', 'minLength', $minLength);
}
@@ -129,7 +130,7 @@ class PasswordPolicyConfig {
*
* @param bool $enforceUpperLowerCase
*/
- public function setEnforceUpperLowerCase($enforceUpperLowerCase) {
+ public function setEnforceUpperLowerCase(bool $enforceUpperLowerCase) {
$value = $enforceUpperLowerCase === true ? '1' : '0';
$this->config->setAppValue('password_policy', 'enforceUpperLowerCase', $value);
}
@@ -139,7 +140,7 @@ class PasswordPolicyConfig {
*
* @param bool $enforceNumericCharacters
*/
- public function setEnforceNumericCharacters($enforceNumericCharacters) {
+ public function setEnforceNumericCharacters(bool $enforceNumericCharacters) {
$value = $enforceNumericCharacters === true ? '1' : '0';
$this->config->setAppValue('password_policy', 'enforceNumericCharacters', $value);
}
@@ -149,7 +150,7 @@ class PasswordPolicyConfig {
*
* @param bool $enforceSpecialCharacters
*/
- public function setEnforceSpecialCharacters($enforceSpecialCharacters) {
+ public function setEnforceSpecialCharacters(bool $enforceSpecialCharacters) {
$value = $enforceSpecialCharacters === true ? '1' : '0';
$this->config->setAppValue('password_policy', 'enforceSpecialCharacters', $value);
}
@@ -159,7 +160,7 @@ class PasswordPolicyConfig {
*
* @return bool
*/
- public function getEnforceHaveIBeenPwned() {
+ public function getEnforceHaveIBeenPwned(): bool {
return $this->config->getAppValue(
'password_policy',
'enforceHaveIBeenPwned',
@@ -172,7 +173,7 @@ class PasswordPolicyConfig {
*
* @param bool $enforceHaveIBeenPwned
*/
- public function setEnforceHaveIBeenPwned($enforceHaveIBeenPwned) {
+ public function setEnforceHaveIBeenPwned(bool $enforceHaveIBeenPwned) {
$this->config->setAppValue('password_policy', 'enforceHaveIBeenPwned', $enforceHaveIBeenPwned ? '1' : '0');
}
diff --git a/lib/PasswordValidator.php b/lib/PasswordValidator.php
index 6b7ae4a..c5293e9 100644
--- a/lib/PasswordValidator.php
+++ b/lib/PasswordValidator.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Bjoern Schiessle <bjoern@schiessle.org>
*
diff --git a/lib/Settings.php b/lib/Settings.php
index dafc93c..250892b 100644
--- a/lib/Settings.php
+++ b/lib/Settings.php
@@ -1,4 +1,5 @@
<?php
+declare(strict_types=1);
/**
* @copyright 2017, Roeland Jago Douma <roeland@famdouma.nl>
*
@@ -35,7 +36,7 @@ class Settings implements ISettings {
$this->config = $config;
}
- public function getForm() {
+ public function getForm(): TemplateResponse {
$response = new TemplateResponse('password_policy', 'settings-admin');
$response->setParams([
'minLength' => $this->config->getMinLength(),
@@ -49,11 +50,11 @@ class Settings implements ISettings {
return $response;
}
- public function getSection() {
+ public function getSection(): string {
return 'security';
}
- public function getPriority() {
+ public function getPriority(): int {
return 50;
}
}