Beispiel #1
0
 /**
  * Returns the manifest data as an array.
  *
  * @param   AppConfiguration    $configuration      The configuration to create the manifest from.
  *
  * @return  array
  */
 public function get(AppConfiguration $configuration)
 {
     $manifest = [];
     if (($backgroundColor = $configuration->getBackgroundColor()) !== null) {
         $manifest["background_color"] = $backgroundColor;
     }
     if (($description = $configuration->getDescription()) !== null) {
         $manifest["description"] = $description;
     }
     if (($direction = $configuration->getDirection()) !== null) {
         $manifest["dir"] = $direction;
     }
     if (($display = $configuration->getDisplay()) !== null) {
         $manifest["display"] = $display;
     }
     if (count($icons = $configuration->getIcons()) > 0) {
         $manifest["icons"] = [];
         foreach ($icons as $icon) {
             $manifest["icons"][] = $this->getImageData($icon);
         }
     }
     if (($language = $configuration->getLanguage()) !== null) {
         $manifest["lang"] = $language;
     }
     if (($name = $configuration->getName()) !== null) {
         $manifest["name"] = $name;
     }
     if (($orientation = $configuration->getOrientation()) !== null) {
         $manifest["orientation"] = $orientation;
     }
     if (($scope = $configuration->getScope()) !== null) {
         $manifest["scope"] = $scope;
     }
     if (count($screenshots = $configuration->getScreenshots()) > 0) {
         $manifest["screenshots"] = [];
         foreach ($screenshots as $screenshot) {
             $manifest["screenshots"][] = $this->getImageData($screenshot);
         }
     }
     if (($shortName = $configuration->getShortName()) !== null) {
         $manifest["short_name"] = $shortName;
     }
     if (($startUrl = $configuration->getStartUrl()) !== null) {
         $manifest["start_url"] = $startUrl;
     }
     if (($themeColor = $configuration->getThemeColor()) !== null) {
         $manifest["theme_color"] = $themeColor;
     }
     return $manifest;
 }