<?php
namespace Moto\Application\FontsManager; use Moto\Json\Server; use Moto; class Service extends Moto\Service\AbstractStaticService { protected static $_resourceName = 'fonts'; protected static $_resourcePrivilegesMap = array( 'getList' => 'get', ); public static function getList() { $apiService = new FontsManagerApi(); $list = $apiService->getList(); if (is_array($list)) { foreach ($list as $i => $item) { $item->name = $item->family; $item->family = '\'' . $item->name . '\', ' . $item->category; $item->last_modified = substr($item->last_modified, 0, 10); $list[$i] = $item; } } return $list; } public static function getFontByFamilyAndProvider($family, $provider) { $response = null; $apiService = new FontsManagerApi(); $list = $apiService->getList(); if ($list) { foreach ($list as $item) { if ($item->family !== $family || $item->provider !== $provider) { continue; } $item->name = $item->family; $item->family = '\'' . $item->name . '\', ' . $item->category; $item->last_modified = substr($item->last_modified, 0, 10); $response = $item; break; } } return $response; } } 