Php cs fix

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2020-04-29 11:50:03 +02:00
parent 50d9e83ed1
commit fcae747c5f
No known key found for this signature in database
GPG key ID: 60C25B8C072916CF
19 changed files with 67 additions and 79 deletions

1
.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
/js/* binary

3
.gitignore vendored
View file

@ -27,3 +27,6 @@ js/
# Compile-Cache
v8-compile-cache-0/
# php-cs cache
.php_cs.cache

17
.php_cs.dist Normal file
View 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;

View file

@ -28,13 +28,9 @@ declare(strict_types=1);
namespace OCA\Forms\AppInfo;
use OCP\AppFramework\App;
use OCP\IL10N;
use OCP\INavigationManager;
use OCP\IURLGenerator;
class Application extends App {
const APP_ID = 'forms';
public const APP_ID = 'forms';
/**
* Application constructor.

View file

@ -47,7 +47,6 @@ use OCP\IUserSession;
use OCP\Security\ISecureRandom;
class ApiController extends Controller {
protected $appName;
/** @var SubmissionMapper */
@ -324,7 +323,6 @@ class ApiController extends Controller {
// Store array of Question-Entities and check the Questions FormId & old Order.
foreach ($newOrder as $arrayKey => $questionId) {
try {
$questions[$arrayKey] = $this->questionMapper->findById($questionId);
} catch (IMapperException $e) {
@ -489,7 +487,7 @@ class ApiController extends Controller {
/**
* @NoAdminRequired
* Writes the given key-value pairs into Database.
*
* @param int $id OptionId of option to update
* @param array $keyValuePairs Array of key=>value pairs to update.
*/
@ -650,7 +648,6 @@ class ApiController extends Controller {
// Load option-text
$answerText = $option['text'];
} else {
$answerText = $answer; // Not a multiple-question, answerText is given answer
}

View file

@ -44,7 +44,6 @@ use OCP\IUserSession;
use OCP\Util;
class PageController extends Controller {
protected $appName;
/** @var FormMapper */

View file

@ -29,13 +29,10 @@ use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserManager;
use OCP\IConfig;
use OCP\IRequest;
class SystemController extends Controller {
public function __construct(
string $appName,
IGroupManager $groupManager,
@ -52,9 +49,9 @@ class SystemController extends Controller {
* @NoAdminRequired
* @return DataResponse
*/
public function getSiteUsersAndGroups($query = '', $getGroups = true, $getUsers = true, $skipGroups = array(), $skipUsers = array()) {
$list = array();
$data = array();
public function getSiteUsersAndGroups($query = '', $getGroups = true, $getUsers = true, $skipGroups = [], $skipUsers = []) {
$list = [];
$data = [];
if ($getGroups) {
$groups = $this->groupManager->search($query);
foreach ($groups as $group) {

View file

@ -59,5 +59,4 @@ class Answer extends Entity {
'text' => htmlspecialchars_decode($this->getText()),
];
}
}

View file

@ -70,5 +70,4 @@ class AnswerMapper extends QBMapper {
$qb->execute();
}
}

View file

@ -50,7 +50,6 @@ use OCP\AppFramework\Db\Entity;
* @method void setSubmitOnce(bool $value)
*/
class Form extends Entity {
protected $hash;
protected $title;
protected $description;

View file

@ -102,5 +102,4 @@ class FormMapper extends QBMapper {
return $this->findEntities($qb);
}
}

View file

@ -26,7 +26,6 @@ declare(strict_types=1);
namespace OCA\Forms\Db;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
use OCP\AppFramework\Db\QBMapper;
@ -80,5 +79,4 @@ class OptionMapper extends QBMapper {
return $this->findEntity($qb);
}
}

View file

@ -48,7 +48,7 @@ class Question extends Entity {
protected $mandatory;
protected $text;
const TYPES = [
public const TYPES = [
'short',
'long',
'multiple',

View file

@ -30,10 +30,7 @@ use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
use OCP\AppFramework\Db\QBMapper;
use OCA\Forms\Db\OptionMapper;
class QuestionMapper extends QBMapper {
private $optionMapper;
public function __construct(IDBConnection $db, OptionMapper $optionMapper) {
@ -102,5 +99,4 @@ class QuestionMapper extends QBMapper {
return $this->findEntity($qb);
}
}

View file

@ -59,5 +59,4 @@ class Submission extends Entity {
'timestamp' => $this->getTimestamp(),
];
}
}

View file

@ -29,10 +29,7 @@ use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
use OCP\AppFramework\Db\QBMapper;
use OCA\Forms\Db\AnswerMapper;
class SubmissionMapper extends QBMapper {
private $answerMapper;
/**

View file

@ -23,11 +23,8 @@
namespace OCA\Forms\Migration;
use Doctrine\DBAL\Exception\TableNotFoundException;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Types\Type;
use OCP\DB\ISchemaWrapper;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\Migration\SimpleMigrationStep;

View file

@ -24,8 +24,6 @@
namespace OCA\Forms\Migration;
use Doctrine\DBAL\Exception\TableNotFoundException;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Types\Type;
use OCP\DB\ISchemaWrapper;
use OCP\DB\QueryBuilder\IQueryBuilder;

View file

@ -59,7 +59,6 @@ class FormsService {
foreach ($optionEntities as $optionEntity) {
$optionList[] = $optionEntity->read();
}
} catch (DoesNotExistException $e) {
//handle silently
} finally {
@ -76,7 +75,6 @@ class FormsService {
$question['options'] = $this->getOptions($question['id']);
$questionList[] = $question;
}
} catch (DoesNotExistException $e) {
//handle silently
} finally {
@ -98,5 +96,4 @@ class FormsService {
return $result;
}
}