Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/ApiConnectors/BrowseDataApiConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ public function getBrowseData(string $code, array $columns, array $sortFields =
{
Assert::minCount($columns, 1);
Assert::allIsInstanceOf($columns, BrowseColumn::class);
Assert::allIsInstanceOf($sortFields, BrowseSortField::class);

if(count($sortFields)) {
Assert::allIsInstanceOf($sortFields, BrowseSortField::class);
}

$requestBrowseData = new BrowseData($code, $columns, $sortFields);

$response = $this->sendXmlDocument($requestBrowseData);
Expand Down
6 changes: 3 additions & 3 deletions src/BrowseDataRow.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function getCode(): string
* @param string $code
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@param string $code should be changed to @param string|null $code

* @return BrowseDataRow
*/
public function setCode(string $code): BrowseDataRow
public function setCode(?string $code): BrowseDataRow
{
$this->code = $code;
return $this;
Expand All @@ -75,7 +75,7 @@ public function getNumber(): int
* @param int $number
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@param int $number should be changed to @param int|null $number

* @return BrowseDataRow
*/
public function setNumber(int $number): BrowseDataRow
public function setNumber(?int $number): BrowseDataRow
{
$this->number = $number;
return $this;
Expand All @@ -93,7 +93,7 @@ public function getLine(): int
* @param int $line
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@param int $line should be changed to @param int|null $line

* @return BrowseDataRow
*/
public function setLine(int $line): BrowseDataRow
public function setLine(?int $line): BrowseDataRow
{
$this->line = $line;
return $this;
Expand Down
8 changes: 6 additions & 2 deletions src/Request/BrowseData.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ public function __construct(string $code, array $columns, array $sortFields = []
parent::__construct();

Assert::allIsInstanceOf($columns, BrowseColumn::class);
Assert::allIsInstanceOf($sortFields, BrowseSortField::class);
if(count($sortFields)) {
Assert::allIsInstanceOf($sortFields, BrowseSortField::class);
}

$this->columnsElement = $this->createElement('columns');
$this->columnsElement->setAttribute('code', $code);
Expand All @@ -48,7 +50,9 @@ public function __construct(string $code, array $columns, array $sortFields = []
$this->columnsElement->appendChild($this->sortElement);

$this->addColumns($columns);
$this->addSortFields($sortFields);
if(count($sortFields)) {
$this->addSortFields($sortFields);
}

$this->appendChild($this->columnsElement);
}
Expand Down