Skip to content
Code-Schnipsel Gruppen Projekte
Commit 76dd9ecc erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

refactor: code style

Übergeordneter 465eb2d7
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
Keine zugehörigen Merge Requests gefunden
werden angezeigt mit 96 Ergänzungen und 93 Löschungen
......@@ -15,6 +15,6 @@
function ($value) {
return \QUI\ERP\Money\Price::validatePrice($value);
},
array('value'),
['value'],
'Permission::checkAdminUser'
);
......@@ -15,11 +15,11 @@
function () {
return array_map(function ($Range) {
/* @var $Range QUI\ERP\Api\NumberRangeInterface */
return array(
return [
'title' => $Range->getTitle(),
'range' => $Range->getRange(),
'class' => get_class($Range)
);
];
}, Coordinator::getInstance()->getNumberRanges());
},
false,
......
......@@ -22,6 +22,6 @@ function ($className, $newIndex) {
}
}
},
array('className', 'newIndex'),
['className', 'newIndex'],
'Permission::checkAdminUser'
);
......@@ -73,7 +73,7 @@ public function __construct($discount, $type)
*/
public static function unserialize($string)
{
$data = array();
$data = [];
if (is_numeric($string)) {
// number, float, int -> 5.99
......@@ -181,11 +181,11 @@ public function setCurrency(Currency $Currency)
*/
public function toArray()
{
return array(
return [
'value' => $this->value,
'type' => $this->type,
'currency' => $this->getCurrency()->toArray()
);
];
}
/**
......@@ -197,4 +197,4 @@ public function toJSON()
{
return json_encode($this->toArray());
}
}
\ No newline at end of file
}
......@@ -22,7 +22,7 @@ interface ArticleInterface
* @param array $attributes - article attributes
* @throws \QUI\Exception
*/
public function __construct($attributes = array());
public function __construct($attributes = []);
/**
* @return ArticleView
......
......@@ -21,7 +21,7 @@ class Address extends QUI\Users\Address
* @param array $data
* @param User|null $User
*/
public function __construct($data = array(), $User = null)
public function __construct($data = [], $User = null)
{
$this->User = $User;
$this->setAttributes($data);
......
......@@ -3,6 +3,7 @@
/**
* This file contains QUI\ERP\Api\AbstractErpProvider
*/
namespace QUI\ERP\Api;
use QUI;
......@@ -21,7 +22,7 @@ abstract class AbstractErpProvider
*/
public static function getMenuItems()
{
return array();
return [];
}
/**
......@@ -29,6 +30,6 @@ public static function getMenuItems()
*/
public static function getNumberRanges()
{
return array();
return [];
}
}
......@@ -26,13 +26,13 @@ class Coordinator extends QUI\Utils\Singleton
public function getErpApiProvider()
{
$cache = 'erp/provider/collection';
$provider = array();
$provider = [];
try {
$collect = QUI\Cache\Manager::get($cache);
} catch (QUI\Cache\Exception $Exception) {
$packages = QUI::getPackageManager()->getInstalled();
$collect = array();
$collect = [];
foreach ($packages as $package) {
try {
......@@ -81,7 +81,7 @@ public function getMenuItems()
try {
$items = QUI\Cache\Manager::get($cache);
} catch (QUI\Cache\Exception $Exception) {
$items = array();
$items = [];
$provider = $this->getErpApiProvider();
/* @var $Provider AbstractErpProvider */
......@@ -100,7 +100,7 @@ public function getMenuItems()
*/
public function getNumberRanges()
{
$ranges = array();
$ranges = [];
$provider = $this->getErpApiProvider();
/* @var $Provider AbstractErpProvider */
......
......@@ -3,6 +3,7 @@
/**
* This file contains QUI\ERP\Api\NumberRangeInterface
*/
namespace QUI\ERP\Api;
use QUI;
......
......@@ -22,14 +22,14 @@ class Comments
/**
* @var array
*/
protected $comments = array();
protected $comments = [];
/**
* Comments constructor.
*
* @param array $comments
*/
public function __construct($comments = array())
public function __construct($comments = [])
{
foreach ($comments as $comment) {
if (isset($comment['message']) && isset($comment['time'])) {
......@@ -95,10 +95,10 @@ public function toArray()
*/
public function addComment($message)
{
$this->comments[] = array(
$this->comments[] = [
'message' => $message,
'time' => time()
);
];
}
/**
......
......@@ -85,9 +85,9 @@ public function log($value, $source = false)
Log::writeException(
$value,
Log::LEVEL_DEBUG,
array(
[
'source' => $source
),
],
'erp-debug',
true
);
......@@ -98,9 +98,9 @@ public function log($value, $source = false)
Log::writeRecursive(
$value,
Log::LEVEL_DEBUG,
array(
[
'source' => $source
),
],
'erp-debug',
true
);
......
......@@ -3,6 +3,7 @@
/**
* This file contains QUI\ERP\Packages\Exception
*/
namespace QUI\ERP\Packages;
use QUI;
......
......@@ -22,84 +22,84 @@ class Installer extends QUI\Utils\Singleton
*
* @var array
*/
protected $packages = array(
'quiqqer/areas' => array(
'server' => array(
protected $packages = [
'quiqqer/areas' => [
'server' => [
'git@dev.quiqqer.com:quiqqer/areas.git'
)
),
]
],
'quiqqer/discount' => array(
'server' => array(
'quiqqer/discount' => [
'server' => [
'git@dev.quiqqer.com:quiqqer/areas.git',
'git@dev.quiqqer.com:quiqqer/discount.git',
'git@dev.quiqqer.com:quiqqer/tax.git',
'git@dev.quiqqer.com:quiqqer/products.git'
)
),
]
],
'quiqqer/invoice' => array(
'server' => array(
'quiqqer/invoice' => [
'server' => [
'git@dev.quiqqer.com:quiqqer/invoice.git',
'git@dev.quiqqer.com:quiqqer/payments.git',
'git@dev.quiqqer.com:quiqqer/employee.git',
'git@dev.quiqqer.com:quiqqer/customer.git'
)
),
]
],
'quiqqer/order' => array(
'server' => array(
'quiqqer/order' => [
'server' => [
'git@dev.quiqqer.com:quiqqer/order.git',
'git@dev.quiqqer.com:quiqqer/products.git',
'git@dev.quiqqer.com:quiqqer/areas.git',
'git@dev.quiqqer.com:quiqqer/discount.git',
'git@dev.quiqqer.com:quiqqer/payments.git'
)
),
]
],
'quiqqer/products' => array(
'server' => array(
'quiqqer/products' => [
'server' => [
'git@dev.quiqqer.com:quiqqer/products.git',
'git@dev.quiqqer.com:quiqqer/areas.git',
'git@dev.quiqqer.com:quiqqer/discount.git'
)
),
]
],
'quiqqer/productstags' => array(
'server' => array(
'quiqqer/productstags' => [
'server' => [
'git@dev.quiqqer.com:quiqqer/productstags.git',
'git@dev.quiqqer.com:quiqqer/products.git',
'git@dev.quiqqer.com:quiqqer/areas.git',
'git@dev.quiqqer.com:quiqqer/discount.git'
)
),
]
],
'quiqqer/productsimportexport' => array(
'server' => array(
'quiqqer/productsimportexport' => [
'server' => [
'git@dev.quiqqer.com:quiqqer/productsimportexport.git',
'git@dev.quiqqer.com:quiqqer/products.git',
'git@dev.quiqqer.com:quiqqer/areas.git',
'git@dev.quiqqer.com:quiqqer/discount.git'
)
),
]
],
'quiqqer/tax' => array(
'server' => array(
'quiqqer/tax' => [
'server' => [
'git@dev.quiqqer.com:quiqqer/tax.git',
'git@dev.quiqqer.com:quiqqer/areas.git'
)
),
]
],
'quiqqer/watchlist' => array(
'server' => array(
'quiqqer/watchlist' => [
'server' => [
'git@dev.quiqqer.com:quiqqer/watchlist.git',
'git@dev.quiqqer.com:quiqqer/products.git',
'git@dev.quiqqer.com:quiqqer/areas.git',
'git@dev.quiqqer.com:quiqqer/discount.git',
'git@dev.quiqqer.com:quiqqer/htmltopdf.git'
)
),
);
]
],
];
/**
* Installs an erp package
......@@ -110,10 +110,10 @@ class Installer extends QUI\Utils\Singleton
public function install($packageName)
{
if (!in_array($packageName, $this->getPackageList())) {
throw new Exception(array(
throw new Exception([
'quiqqer/erp',
'exception.package.is.not.erp.package'
));
]);
}
$this->setPackageRequirements($packageName);
......@@ -142,17 +142,17 @@ public function getPackageList()
protected function getPackageRequirements($packageName)
{
if (!in_array($packageName, $this->getPackageList())) {
throw new Exception(array(
throw new Exception([
'quiqqer/erp',
'exception.erp.package.not.an.erp.package'
));
]);
}
if (!isset($this->packages[$packageName])) {
throw new Exception(array(
throw new Exception([
'quiqqer/erp',
'exception.erp.package.not.found'
));
]);
}
return $this->packages[$packageName];
......@@ -168,10 +168,10 @@ protected function getPackageRequirements($packageName)
public function setPackageRequirements($packageName)
{
if (!in_array($packageName, $this->getPackageList())) {
throw new Exception(array(
throw new Exception([
'quiqqer/erp',
'exception.package.is.not.erp.package'
));
]);
}
$requirements = $this->getPackageRequirements($packageName);
......
......@@ -240,7 +240,7 @@ public function toArray()
$user = $this->User->getAttributes();
}
return array(
return [
'orderId' => $orderId,
'orderInProcessId' => $orderInProcessId,
'invoiceId' => $invoiceId,
......@@ -249,6 +249,6 @@ public function toArray()
'date' => $this->date,
'currencyData' => $this->Currency->toArray(),
'user' => $user,
);
];
}
}
......@@ -51,12 +51,12 @@ public function addPayment(CashInput $CashInput, $Parent)
*/
public function getPaymentsFromInvoice(Invoice $Invoice)
{
$result = QUI::getDataBase()->fetch(array(
$result = QUI::getDataBase()->fetch([
'from' => $this->table(),
'where' => array(
'where' => [
'invoiceId' => $Invoice->getId(),
),
));
],
]);
return $this->parseResult($result);
}
......@@ -67,12 +67,12 @@ public function getPaymentsFromInvoice(Invoice $Invoice)
*/
public function getPaymentsFromOrder(Order $Order)
{
$result = QUI::getDataBase()->fetch(array(
$result = QUI::getDataBase()->fetch([
'from' => $this->table(),
'where' => array(
'where' => [
'orderId' => $Order->getId(),
),
));
],
]);
return $this->parseResult($result);
}
......@@ -83,7 +83,7 @@ public function getPaymentsFromOrder(Order $Order)
*/
protected function parseResult(array $result)
{
$cashInputs = array();
$cashInputs = [];
foreach ($result as $entry) {
$cashInputs[] = $this->parseDataToCashInput($entry);
......
......@@ -61,14 +61,14 @@ class User extends QUI\QDOM implements UserInterface
/**
* @var array
*/
protected $data = array();
protected $data = [];
/**
* Address data
*
* @var array
*/
protected $address = array();
protected $address = [];
/**
* User constructor.
......@@ -126,7 +126,7 @@ public function __construct(array $attributes)
*/
public static function getNeedles()
{
return array(
return [
'id',
'country',
'username',
......@@ -134,7 +134,7 @@ public static function getNeedles()
'lastname',
'lang',
'isCompany'
);
];
}
/**
......@@ -143,7 +143,7 @@ public static function getNeedles()
*/
public static function getMissingAttributes(array $attributes)
{
$missing = array();
$missing = [];
$needles = self::getNeedles();
foreach ($needles as $needle) {
......@@ -172,7 +172,7 @@ public static function convertUserToErpUser(QUI\Interfaces\Users\User $User)
$country = $Country->getCode();
}
return new self(array(
return new self([
'id' => $User->getId(),
'country' => $country,
'username' => $User->getUsername(),
......@@ -181,7 +181,7 @@ public static function convertUserToErpUser(QUI\Interfaces\Users\User $User)
'lang' => $User->getLang(),
'isCompany' => $User->isCompany(),
'data' => $User->getAttributes()
));
]);
}
/**
......@@ -476,7 +476,7 @@ public function setGroups($groups)
*/
public function getGroups($array = true)
{
return array();
return [];
}
/**
......
......@@ -164,10 +164,10 @@ public static function getUserArea(UserInterface $User)
public static function getUserERPAddress(UserInterface $User)
{
if (!QUI::getUsers()->isUser($User)) {
throw new QUI\Exception(array(
throw new QUI\Exception([
'quiqqer/erp',
'exception.no.user'
));
]);
}
/* @var $User QUI\Users\User */
......@@ -204,7 +204,7 @@ public static function getShopArea()
* @param $attributes
* @return array
*/
public static function filterCustomerAttributes($attributes = array())
public static function filterCustomerAttributes($attributes = [])
{
if (!is_array($attributes)) {
return [];
......
<?php
// include quiqqer bootstrap for tests
require dirname(dirname(dirname(__FILE__))) . '/quiqqer/tests/bootstrap.php';
require dirname(dirname(dirname(__FILE__))).'/quiqqer/tests/bootstrap.php';
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren