!empty($node['id']) ? (string)$node['id'] : null, 'src' => !empty($node['src']) ? (string)$node['src'] : null, 'ext' => !empty($node['ext']) ? (string)$node['ext'] : $structureExtensionId ]); } /** * @param array $iconData * @param string $structureExtensionId * @return static */ public static function fromArray(array $iconData, $structureExtensionId) { return new static([ 'id' => !empty($iconData['id']) ? (string)$iconData['id'] : null, 'src' => !empty($iconData['src']) ? (string)$iconData['src'] : null, 'ext' => !empty($iconData['ext']) ? (string)$iconData['ext'] : $structureExtensionId ]); } public static function createLegacyItem($iconId, $src = null) { return new static([ 'id' => (string)$iconId, 'src' => isset($src) ? (string)$src : null ]); } public function __construct($data, $version = self::SERIAL_VERSION) { $this->data = $data; } public function getId() { return $this->data['id']; } public function getSource() { return $this->data['src']; } public function getExtension() { return $this->data['ext']; } public function __toPhpCode() { return "new " . __CLASS__ . "(" . \common_Utils::toPHPVariableString($this->data) . ',' . \common_Utils::toPHPVariableString(self::SERIAL_VERSION) . ")"; } }