|
- <?php
-
-
-
- namespace Fxp\Composer\AssetPlugin\Converter;
-
-
- abstract class NpmPackageUtil
- {
-
-
- public static function convertAuthor($value)
- {
- if (null !== $value) {
- $value = array($value);
- }
-
- return $value;
- }
-
-
-
- public static function convertContributors($value, $prevValue)
- {
- $mergeValue = is_array($prevValue) ? $prevValue : array();
- $mergeValue = array_merge($mergeValue, is_array($value) ? $value : array());
-
- if (count($mergeValue) > 0) {
- $value = $mergeValue;
- }
-
- return $value;
- }
-
-
-
- public static function convertDist($value)
- {
- if (is_array($value)) {
- $data = (array) $value;
- $value = array();
-
- foreach ($data as $type => $url) {
- if ('shasum' === $type) {
- $value[$type] = $url;
- } else {
- $value['type'] = 'tarball' === $type ? 'tar' : $type;
- $value['url'] = $url;
- }
- }
- }
-
- return $value;
- }
- }
|