Php cs fix
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
50d9e83ed1
commit
fcae747c5f
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/js/* binary
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -27,3 +27,6 @@ js/
|
||||||
|
|
||||||
# Compile-Cache
|
# Compile-Cache
|
||||||
v8-compile-cache-0/
|
v8-compile-cache-0/
|
||||||
|
|
||||||
|
# php-cs cache
|
||||||
|
.php_cs.cache
|
17
.php_cs.dist
Normal file
17
.php_cs.dist
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
require_once './vendor/autoload.php';
|
||||||
|
|
||||||
|
use Nextcloud\CodingStandard\Config;
|
||||||
|
|
||||||
|
$config = new Config();
|
||||||
|
$config
|
||||||
|
->getFinder()
|
||||||
|
->notPath('build')
|
||||||
|
->notPath('l10n')
|
||||||
|
->notPath('src')
|
||||||
|
->notPath('vendor')
|
||||||
|
->in(__DIR__);
|
||||||
|
return $config;
|
|
@ -28,13 +28,9 @@ declare(strict_types=1);
|
||||||
namespace OCA\Forms\AppInfo;
|
namespace OCA\Forms\AppInfo;
|
||||||
|
|
||||||
use OCP\AppFramework\App;
|
use OCP\AppFramework\App;
|
||||||
use OCP\IL10N;
|
|
||||||
use OCP\INavigationManager;
|
|
||||||
use OCP\IURLGenerator;
|
|
||||||
|
|
||||||
class Application extends App {
|
class Application extends App {
|
||||||
|
public const APP_ID = 'forms';
|
||||||
const APP_ID = 'forms';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Application constructor.
|
* Application constructor.
|
||||||
|
|
|
@ -47,7 +47,6 @@ use OCP\IUserSession;
|
||||||
use OCP\Security\ISecureRandom;
|
use OCP\Security\ISecureRandom;
|
||||||
|
|
||||||
class ApiController extends Controller {
|
class ApiController extends Controller {
|
||||||
|
|
||||||
protected $appName;
|
protected $appName;
|
||||||
|
|
||||||
/** @var SubmissionMapper */
|
/** @var SubmissionMapper */
|
||||||
|
@ -324,7 +323,6 @@ class ApiController extends Controller {
|
||||||
|
|
||||||
// Store array of Question-Entities and check the Questions FormId & old Order.
|
// Store array of Question-Entities and check the Questions FormId & old Order.
|
||||||
foreach ($newOrder as $arrayKey => $questionId) {
|
foreach ($newOrder as $arrayKey => $questionId) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$questions[$arrayKey] = $this->questionMapper->findById($questionId);
|
$questions[$arrayKey] = $this->questionMapper->findById($questionId);
|
||||||
} catch (IMapperException $e) {
|
} catch (IMapperException $e) {
|
||||||
|
@ -489,7 +487,7 @@ class ApiController extends Controller {
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* Writes the given key-value pairs into Database.
|
* Writes the given key-value pairs into Database.
|
||||||
|
*
|
||||||
* @param int $id OptionId of option to update
|
* @param int $id OptionId of option to update
|
||||||
* @param array $keyValuePairs Array of key=>value pairs to update.
|
* @param array $keyValuePairs Array of key=>value pairs to update.
|
||||||
*/
|
*/
|
||||||
|
@ -650,7 +648,6 @@ class ApiController extends Controller {
|
||||||
|
|
||||||
// Load option-text
|
// Load option-text
|
||||||
$answerText = $option['text'];
|
$answerText = $option['text'];
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$answerText = $answer; // Not a multiple-question, answerText is given answer
|
$answerText = $answer; // Not a multiple-question, answerText is given answer
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,6 @@ use OCP\IUserSession;
|
||||||
use OCP\Util;
|
use OCP\Util;
|
||||||
|
|
||||||
class PageController extends Controller {
|
class PageController extends Controller {
|
||||||
|
|
||||||
protected $appName;
|
protected $appName;
|
||||||
|
|
||||||
/** @var FormMapper */
|
/** @var FormMapper */
|
||||||
|
|
|
@ -29,13 +29,10 @@ use OCP\AppFramework\Http;
|
||||||
use OCP\AppFramework\Http\DataResponse;
|
use OCP\AppFramework\Http\DataResponse;
|
||||||
|
|
||||||
use OCP\IGroupManager;
|
use OCP\IGroupManager;
|
||||||
use OCP\IUser;
|
|
||||||
use OCP\IUserManager;
|
use OCP\IUserManager;
|
||||||
use OCP\IConfig;
|
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
|
||||||
class SystemController extends Controller {
|
class SystemController extends Controller {
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
string $appName,
|
string $appName,
|
||||||
IGroupManager $groupManager,
|
IGroupManager $groupManager,
|
||||||
|
@ -52,9 +49,9 @@ class SystemController extends Controller {
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @return DataResponse
|
* @return DataResponse
|
||||||
*/
|
*/
|
||||||
public function getSiteUsersAndGroups($query = '', $getGroups = true, $getUsers = true, $skipGroups = array(), $skipUsers = array()) {
|
public function getSiteUsersAndGroups($query = '', $getGroups = true, $getUsers = true, $skipGroups = [], $skipUsers = []) {
|
||||||
$list = array();
|
$list = [];
|
||||||
$data = array();
|
$data = [];
|
||||||
if ($getGroups) {
|
if ($getGroups) {
|
||||||
$groups = $this->groupManager->search($query);
|
$groups = $this->groupManager->search($query);
|
||||||
foreach ($groups as $group) {
|
foreach ($groups as $group) {
|
||||||
|
|
|
@ -59,5 +59,4 @@ class Answer extends Entity {
|
||||||
'text' => htmlspecialchars_decode($this->getText()),
|
'text' => htmlspecialchars_decode($this->getText()),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,5 +70,4 @@ class AnswerMapper extends QBMapper {
|
||||||
|
|
||||||
$qb->execute();
|
$qb->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,6 @@ use OCP\AppFramework\Db\Entity;
|
||||||
* @method void setSubmitOnce(bool $value)
|
* @method void setSubmitOnce(bool $value)
|
||||||
*/
|
*/
|
||||||
class Form extends Entity {
|
class Form extends Entity {
|
||||||
|
|
||||||
protected $hash;
|
protected $hash;
|
||||||
protected $title;
|
protected $title;
|
||||||
protected $description;
|
protected $description;
|
||||||
|
|
|
@ -102,5 +102,4 @@ class FormMapper extends QBMapper {
|
||||||
|
|
||||||
return $this->findEntities($qb);
|
return $this->findEntities($qb);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace OCA\Forms\Db;
|
namespace OCA\Forms\Db;
|
||||||
|
|
||||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
|
||||||
use OCP\IDBConnection;
|
use OCP\IDBConnection;
|
||||||
use OCP\AppFramework\Db\QBMapper;
|
use OCP\AppFramework\Db\QBMapper;
|
||||||
|
|
||||||
|
@ -80,5 +79,4 @@ class OptionMapper extends QBMapper {
|
||||||
|
|
||||||
return $this->findEntity($qb);
|
return $this->findEntity($qb);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ class Question extends Entity {
|
||||||
protected $mandatory;
|
protected $mandatory;
|
||||||
protected $text;
|
protected $text;
|
||||||
|
|
||||||
const TYPES = [
|
public const TYPES = [
|
||||||
'short',
|
'short',
|
||||||
'long',
|
'long',
|
||||||
'multiple',
|
'multiple',
|
||||||
|
|
|
@ -30,10 +30,7 @@ use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||||
use OCP\IDBConnection;
|
use OCP\IDBConnection;
|
||||||
use OCP\AppFramework\Db\QBMapper;
|
use OCP\AppFramework\Db\QBMapper;
|
||||||
|
|
||||||
use OCA\Forms\Db\OptionMapper;
|
|
||||||
|
|
||||||
class QuestionMapper extends QBMapper {
|
class QuestionMapper extends QBMapper {
|
||||||
|
|
||||||
private $optionMapper;
|
private $optionMapper;
|
||||||
|
|
||||||
public function __construct(IDBConnection $db, OptionMapper $optionMapper) {
|
public function __construct(IDBConnection $db, OptionMapper $optionMapper) {
|
||||||
|
@ -102,5 +99,4 @@ class QuestionMapper extends QBMapper {
|
||||||
|
|
||||||
return $this->findEntity($qb);
|
return $this->findEntity($qb);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,5 +59,4 @@ class Submission extends Entity {
|
||||||
'timestamp' => $this->getTimestamp(),
|
'timestamp' => $this->getTimestamp(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,10 +29,7 @@ use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||||
use OCP\IDBConnection;
|
use OCP\IDBConnection;
|
||||||
use OCP\AppFramework\Db\QBMapper;
|
use OCP\AppFramework\Db\QBMapper;
|
||||||
|
|
||||||
use OCA\Forms\Db\AnswerMapper;
|
|
||||||
|
|
||||||
class SubmissionMapper extends QBMapper {
|
class SubmissionMapper extends QBMapper {
|
||||||
|
|
||||||
private $answerMapper;
|
private $answerMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,11 +23,8 @@
|
||||||
|
|
||||||
namespace OCA\Forms\Migration;
|
namespace OCA\Forms\Migration;
|
||||||
|
|
||||||
use Doctrine\DBAL\Exception\TableNotFoundException;
|
|
||||||
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
|
|
||||||
use Doctrine\DBAL\Types\Type;
|
use Doctrine\DBAL\Types\Type;
|
||||||
use OCP\DB\ISchemaWrapper;
|
use OCP\DB\ISchemaWrapper;
|
||||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
|
||||||
use OCP\IConfig;
|
use OCP\IConfig;
|
||||||
use OCP\IDBConnection;
|
use OCP\IDBConnection;
|
||||||
use OCP\Migration\SimpleMigrationStep;
|
use OCP\Migration\SimpleMigrationStep;
|
||||||
|
|
|
@ -24,8 +24,6 @@
|
||||||
|
|
||||||
namespace OCA\Forms\Migration;
|
namespace OCA\Forms\Migration;
|
||||||
|
|
||||||
use Doctrine\DBAL\Exception\TableNotFoundException;
|
|
||||||
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
|
|
||||||
use Doctrine\DBAL\Types\Type;
|
use Doctrine\DBAL\Types\Type;
|
||||||
use OCP\DB\ISchemaWrapper;
|
use OCP\DB\ISchemaWrapper;
|
||||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||||
|
|
|
@ -59,7 +59,6 @@ class FormsService {
|
||||||
foreach ($optionEntities as $optionEntity) {
|
foreach ($optionEntities as $optionEntity) {
|
||||||
$optionList[] = $optionEntity->read();
|
$optionList[] = $optionEntity->read();
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (DoesNotExistException $e) {
|
} catch (DoesNotExistException $e) {
|
||||||
//handle silently
|
//handle silently
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -76,7 +75,6 @@ class FormsService {
|
||||||
$question['options'] = $this->getOptions($question['id']);
|
$question['options'] = $this->getOptions($question['id']);
|
||||||
$questionList[] = $question;
|
$questionList[] = $question;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (DoesNotExistException $e) {
|
} catch (DoesNotExistException $e) {
|
||||||
//handle silently
|
//handle silently
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -98,5 +96,4 @@ class FormsService {
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue