Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
- Added service `Services\Log\BlogPost\Service\BlogPost` with support method:
- `add` - Add new blog post to Live Feed with support for all parameters (title, destination, files, importance, etc.)

### Fixed
- Fixed typehints in the ApplicationInfo method [see details](https://github.com/bitrix24/b24phpsdk/issues/219)

## 1.5.0 – 2025.08.01

### Added
Expand Down
78 changes: 67 additions & 11 deletions src/Services/Main/Result/ApplicationInfoItemResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,84 @@
namespace Bitrix24\SDK\Services\Main\Result;

use Bitrix24\SDK\Application\ApplicationStatus;
use Bitrix24\SDK\Application\PortalLicenseFamily;
use Bitrix24\SDK\Core\Credentials\Scope;
use Bitrix24\SDK\Core\Exceptions\InvalidArgumentException;
use Bitrix24\SDK\Core\Exceptions\UnknownScopeCodeException;
use Bitrix24\SDK\Core\Result\AbstractItem;

/**
* Class ApplicationInfoResult
*
* @property-read int $ID
* @property-read string $CODE
* @property-read array $SCOPE
* @property-read int $VERSION
* @property-read string $STATUS
* @property-read boolean $INSTALLED
* @property-read string $PAYMENT_EXPIRED
* @property-read int $DAYS
* @property-read string $LICENSE
* Webhook credentials will return only this field:
* SCOPE
* LICENSE
*
* @property-read int|null $ID
* @property-read string|null $CODE
* @property-read Scope|null $SCOPE
* @property-read int|null $VERSION
* @property-read ApplicationStatus|null $STATUS
* @property-read boolean|null $INSTALLED
* @property-read boolean|null $PAYMENT_EXPIRED
* @property-read int|null $DAYS
* @property-read string|null $LANGUAGE_ID
* @property-read string|null $LICENSE
* @property-read string|null $LICENSE_TYPE
* @property-read PortalLicenseFamily|null $LICENSE_FAMILY
*/
class ApplicationInfoItemResult extends AbstractItem
{
/**
* @throws \Bitrix24\SDK\Core\Exceptions\InvalidArgumentException
* @throws UnknownScopeCodeException
* @throws InvalidArgumentException
*/
public function __get($offset)
{
switch ($offset) {
case 'LICENSE_FAMILY':
if ($this->data[$offset] !== '' && $this->data[$offset] !== null) {
return PortalLicenseFamily::from($this->data[$offset]);
}

return null;
case 'PAYMENT_EXPIRED':
if ($this->data[$offset] !== '' && $this->data[$offset] !== null) {
return $this->data[$offset] === 'Y';
}

return null;
case 'INSTALLED':
if ($this->data[$offset] !== '' && $this->data[$offset] !== null) {
return (bool)$this->data[$offset];
}

return null;
case 'ID':
if ($this->data[$offset] !== '' && $this->data[$offset] !== null) {
return (int)$this->data[$offset];
}

return null;
case 'SCOPE':
if ($this->data[$offset] !== '' && $this->data[$offset] !== null) {
return new Scope($this->data[$offset]);
}

return null;
case 'STATUS':
if ($this->data[$offset] !== '' && $this->data[$offset] !== null) {
return new ApplicationStatus($this->data[$offset]);
}

return null;
default:
return $this->data[$offset] ?? null;
}
}

public function getStatus(): ?ApplicationStatus
{
return $this->STATUS !== null ? new ApplicationStatus($this->STATUS) : null;
return $this->STATUS;
}
}