Skip to content

Commit

Permalink
Ran cs fixer (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Ducoudray authored Jun 21, 2016
1 parent 203befe commit 12eb233
Show file tree
Hide file tree
Showing 57 changed files with 743 additions and 671 deletions.
2 changes: 1 addition & 1 deletion .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ return Symfony\CS\Config\Config::create()
// use default SYMFONY_LEVEL and extra fixers:
->fixers(array(
'header_comment',
'long_array_syntax',
'short_array_syntax',
'ordered_use',
'php_unit_construct',
'php_unit_strict',
Expand Down
4 changes: 2 additions & 2 deletions lib/Textmaster/Api/Author.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ class Author extends AbstractApi
public function find(array $params)
{
foreach ($params as $name => $value) {
if (!in_array($name, array(
if (!in_array($name, [
'name',
'ctype',
'options',
'language_from',
'language_to',
'project_briefing',
'category',
), true)) {
], true)) {
throw new InvalidArgumentException(sprintf('"%s" is not a valid author search parameter.', $name));
}
}
Expand Down
20 changes: 10 additions & 10 deletions lib/Textmaster/Api/Author/Mine.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Mine extends AbstractApi
*/
public function all($status = null)
{
$params = array();
$params = [];

if (null !== $status) {
if (!$this->isValidStatus($status)) {
Expand Down Expand Up @@ -61,12 +61,12 @@ public function add($authorId, $status, $description = null)
throw new InvalidArgumentException(sprintf('"%s" is not valid author status.', $status));
}

$params = array(
'my_author' => array(
$params = [
'my_author' => [
'author_id' => $authorId,
'status' => $status,
),
);
],
];

if (null !== $description) {
$params['my_author']['description'] = $description;
Expand Down Expand Up @@ -94,11 +94,11 @@ public function update($authorId, $status, $description = null)
throw new InvalidArgumentException(sprintf('"%s" is not valid author status.', $status));
}

$params = array(
'my_author' => array(
$params = [
'my_author' => [
'status' => $status,
),
);
],
];

if (null !== $description) {
$params['my_author']['description'] = $description;
Expand Down Expand Up @@ -146,6 +146,6 @@ protected function getPath($authorId = null)
*/
protected function isValidStatus($status)
{
return in_array($status, array('my_textmaster', 'blacklisted', 'uncategorized'), true);
return in_array($status, ['my_textmaster', 'blacklisted', 'uncategorized'], true);
}
}
2 changes: 1 addition & 1 deletion lib/Textmaster/Api/Expertise.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Expertise extends AbstractApi
*/
public function all($activity, $locale = null)
{
$params = array('activity' => $activity);
$params = ['activity' => $activity];

if (null !== $locale) {
$params['locale'] = $locale;
Expand Down
4 changes: 2 additions & 2 deletions lib/Textmaster/Api/Expertise/SubExpertise.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class SubExpertise extends AbstractApi
*/
public function all($expertiseId, $locale = null)
{
$params = array();
$params = [];

if (null !== $locale) {
$params['locale'] = $locale;
Expand All @@ -54,7 +54,7 @@ public function all($expertiseId, $locale = null)
*/
public function show($expertiseId, $subExpertiseId, $locale = null)
{
$params = array();
$params = [];

if (null !== $locale) {
$params['locale'] = $locale;
Expand Down
2 changes: 1 addition & 1 deletion lib/Textmaster/Api/FilterableApiInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ interface FilterableApiInterface
*
* @return array
*/
public function filter(array $where = array(), array $order = array());
public function filter(array $where = [], array $order = []);

/**
* Get API client.
Expand Down
8 changes: 4 additions & 4 deletions lib/Textmaster/Api/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ public function all()
*
* @return array
*/
public function filter(array $where = array(), array $order = array())
public function filter(array $where = [], array $order = [])
{
$params = array();
$params = [];

empty($where) ?: $params['where'] = json_encode($where);
empty($order) ?: $params['order'] = json_encode($order);
Expand Down Expand Up @@ -80,7 +80,7 @@ public function show($projectId)
*/
public function create(array $params)
{
return $this->post($this->getPath(), array('project' => $params));
return $this->post($this->getPath(), ['project' => $params]);
}

/**
Expand Down Expand Up @@ -193,7 +193,7 @@ public function launch($projectId)
*/
public function quote(array $params)
{
return $this->get($this->getPath().'/quotation', array('project' => $params));
return $this->get($this->getPath().'/quotation', ['project' => $params]);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/Textmaster/Api/Project/Author.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ public function __construct(Client $client, $projectId)
*/
public function all($status = null)
{
$params = array();
$params = [];

if (null !== $status && in_array($status, array('my_textmaster', 'blacklisted', 'uncategorized'), true)) {
if (null !== $status && in_array($status, ['my_textmaster', 'blacklisted', 'uncategorized'], true)) {
$params['status'] = $status;
}

Expand Down
14 changes: 7 additions & 7 deletions lib/Textmaster/Api/Project/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ public function all()
*
* @return array
*/
public function filter(array $where = array(), array $order = array())
public function filter(array $where = [], array $order = [])
{
$params = array();
$params = [];

empty($where) ?: $params['where'] = json_encode($where);
empty($order) ?: $params['order'] = json_encode($order);
Expand Down Expand Up @@ -100,7 +100,7 @@ public function show($documentId)
*/
public function create(array $params)
{
return $this->post($this->getPath(), array('document' => $params));
return $this->post($this->getPath(), ['document' => $params]);
}

/**
Expand Down Expand Up @@ -145,7 +145,7 @@ public function remove($documentId)
*/
public function complete($documentId, $satisfaction = null, $message = null)
{
$params = array();
$params = [];

if (null !== $satisfaction) {
$params['satisfaction'] = $satisfaction;
Expand All @@ -170,9 +170,9 @@ public function complete($documentId, $satisfaction = null, $message = null)
*/
public function batchComplete(array $documentIds, $satisfaction = null, $message = null)
{
$params = array(
$params = [
'documents' => $documentIds,
);
];

if (null !== $satisfaction) {
$params['satisfaction'] = $satisfaction;
Expand All @@ -195,7 +195,7 @@ public function batchComplete(array $documentIds, $satisfaction = null, $message
*/
public function batchCreate(array $documents)
{
return $this->post('clients/projects/'.rawurlencode($this->projectId).'/batch/documents', array('documents' => $documents));
return $this->post('clients/projects/'.rawurlencode($this->projectId).'/batch/documents', ['documents' => $documents]);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions lib/Textmaster/Api/Project/Document/SupportMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ public function all($projectId, $documentId)
*/
public function create($projectId, $documentId, $message)
{
return $this->post($this->getPath($projectId, $documentId), array(
'support_message' => array('message' => $message),
));
return $this->post($this->getPath($projectId, $documentId), [
'support_message' => ['message' => $message],
]);
}

/**
Expand Down
20 changes: 10 additions & 10 deletions lib/Textmaster/Api/User/Callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,23 @@ class Callback extends AbstractApi
*/
public function set($userId, $event, $url, $format)
{
if (!in_array($event, array('waiting_assignment', 'completed'), true)) {
if (!in_array($event, ['waiting_assignment', 'completed'], true)) {
throw new InvalidArgumentException(sprintf('"%s" is not a valid callback event.', $event));
}

if (!in_array($format, array('json', 'xml'), true)) {
if (!in_array($format, ['json', 'xml'], true)) {
throw new InvalidArgumentException(sprintf('"%s" is not a valid callback format.', $format));
}

return $this->put('clients/users/'.rawurlencode($userId), array(
'user' => array(
'callback' => array(
$event => array(
return $this->put('clients/users/'.rawurlencode($userId), [
'user' => [
'callback' => [
$event => [
'url' => $url,
'format' => $format,
),
),
),
));
],
],
],
]);
}
}
6 changes: 3 additions & 3 deletions lib/Textmaster/CallbackHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ class CallbackHandler
/**
* @var array
*/
protected $classes = array(
protected $classes = [
'document' => 'Textmaster\Model\Document',
'project' => 'Textmaster\Model\Project',
);
];

/**
* Constructor.
Expand All @@ -44,7 +44,7 @@ class CallbackHandler
* @param Client $client
* @param array $classes
*/
public function __construct(EventDispatcherInterface $dispatcher, Client $client, array $classes = array())
public function __construct(EventDispatcherInterface $dispatcher, Client $client, array $classes = [])
{
$this->dispatcher = $dispatcher;
$this->client = $client;
Expand Down
8 changes: 4 additions & 4 deletions lib/Textmaster/Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ final class Events
*/
public static function getDocumentEvents()
{
return array(
return [
self::DOCUMENT_IN_CREATION,
self::DOCUMENT_WAITING_ASSIGNMENT,
self::DOCUMENT_IN_PROGRESS,
Expand All @@ -146,7 +146,7 @@ public static function getDocumentEvents()
self::DOCUMENT_IN_REVIEW,
self::DOCUMENT_INCOMPLETE,
self::DOCUMENT_COMPLETED,
);
];
}

/**
Expand All @@ -156,8 +156,8 @@ public static function getDocumentEvents()
*/
public static function getProjectEvents()
{
return array(
return [
self::PROJECT_IN_PROGRESS,
);
];
}
}
8 changes: 4 additions & 4 deletions lib/Textmaster/Exception/MappingNotFoundException.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

/*
* This file is part of the Sylius package.
* This file is part of the Textmaster Api v1 client package.
*
* (c) Paweł Jędrzejewski
* (c) Christian Daguerre <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace Textmaster\Exception;
Expand Down
2 changes: 1 addition & 1 deletion lib/Textmaster/Exception/MissingArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class MissingArgumentException extends ErrorException
public function __construct($required, $code = 0, $previous = null)
{
if (is_string($required)) {
$required = array($required);
$required = [$required];
}

parent::__construct(sprintf('One or more of required ("%s") parameters is missing!', implode('", "', $required)), $code, $previous);
Expand Down
8 changes: 4 additions & 4 deletions lib/Textmaster/Exception/UnexpectedTypeException.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

/*
* This file is part of the Sylius package.
* This file is part of the Textmaster Api v1 client package.
*
* (c) Paweł Jędrzejewski
* (c) Christian Daguerre <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace Textmaster\Exception;
Expand Down
10 changes: 5 additions & 5 deletions lib/Textmaster/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ class Manager
/**
* @var array
*/
protected $classes = array(
protected $classes = [
'document' => 'Textmaster\Model\Document',
'project' => 'Textmaster\Model\Project',
);
];

/**
* Constructor.
*
* @param Client $client
* @param array $classes
*/
public function __construct(Client $client, array $classes = array())
public function __construct(Client $client, array $classes = [])
{
$this->client = $client;
$this->classes = array_merge($this->classes, $classes);
Expand All @@ -62,7 +62,7 @@ public function getProject($id = null)
*
* @return Pagerfanta
*/
public function getProjects(array $where = array(), array $order = array())
public function getProjects(array $where = [], array $order = [])
{
/** @var FilterableApiInterface $api */
$api = $this->client->api('projects');
Expand All @@ -82,7 +82,7 @@ public function getDocument($projectId, $id)
{
return new $this->classes['document'](
$this->client,
array('project_id' => $projectId, 'id' => $id)
['project_id' => $projectId, 'id' => $id]
);
}
}
Loading

0 comments on commit 12eb233

Please sign in to comment.