当前位置: 首页>>代码示例>>PHP>>正文


PHP Util::map方法代码示例

本文整理汇总了PHP中League\Flysystem\Util::map方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::map方法的具体用法?PHP Util::map怎么用?PHP Util::map使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在League\Flysystem\Util的用法示例。


在下文中一共展示了Util::map方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: normalizeResponse

 /**
  * Normalize the object result array.
  *
  * @param array  $response
  * @param string $path
  *
  * @return array
  */
 protected function normalizeResponse(array $response, $path = null)
 {
     $result = ['path' => $path ?: $this->removePathPrefix($response['Key'])];
     $result = array_merge($result, Util::pathinfo($result['path']));
     if (isset($response['LastModified'])) {
         $result['timestamp'] = strtotime($response['LastModified']);
     }
     if (substr($result['path'], -1) === '/') {
         $result['type'] = 'dir';
         $result['path'] = rtrim($result['path'], '/');
         return $result;
     }
     return array_merge($result, Util::map($response, static::$resultMap), ['type' => 'file']);
 }
开发者ID:janhartigan,项目名称:flysystem-aws-s3-v3,代码行数:22,代码来源:AwsS3Adapter.php

示例2: normalizeObject

 /**
  * Normalize a result from AWS
  *
  * @param   string  $object
  * @param   string  $path
  * @return  array   file metadata
  */
 protected function normalizeObject($object, $path = null)
 {
     $result = array('path' => $path ?: $object['Key']);
     if (isset($object['LastModified'])) {
         $result['timestamp'] = strtotime($object['LastModified']);
     }
     $result = array_merge($result, Util::map($object, static::$resultMap), array('type' => 'file'));
     $result['dirname'] = Util::dirname($result['path']);
     if (isset($result['contents'])) {
         $result['contents'] = (string) $result['contents'];
     }
     return $result;
 }
开发者ID:luoshulin,项目名称:falcon,代码行数:20,代码来源:AwsS3.php

示例3: normalizeObject

 /**
  * Normalize a zip response array.
  *
  * @param array $object
  *
  * @return array
  */
 protected function normalizeObject(array $object)
 {
     if (substr($object['name'], -1) === '/') {
         return ['path' => $this->removePathPrefix(trim($object['name'], '/')), 'type' => 'dir'];
     }
     $result = ['type' => 'file'];
     $normalised = Util::map($object, static::$resultMap);
     $normalised['path'] = $this->removePathPrefix($normalised['path']);
     return array_merge($result, $normalised);
 }
开发者ID:johnkewforks,项目名称:filemanager-backend,代码行数:17,代码来源:ZipArchiveAdapter.php

示例4: normalizeObject

 protected function normalizeObject($object, $path = null)
 {
     $result = array('path' => $path ?: ltrim($object['path'], '/'));
     if (isset($object['modified'])) {
         $result['timestamp'] = strtotime($object['modified']);
     }
     $result = array_merge($result, Util::map($object, static::$resultMap));
     $result['type'] = $object['is_dir'] ? 'dir' : 'file';
     return $result;
 }
开发者ID:VasekPurchart,项目名称:khanovaskola-v3,代码行数:10,代码来源:Dropbox.php

示例5: normalizeObject

 /**
  * Normalize a result from Copy.
  *
  * @param stdClass $object
  * @param string   $path
  *
  * @return array|false file metadata
  */
 protected function normalizeObject($object, $path)
 {
     if (!$object instanceof stdClass) {
         return false;
     }
     if (isset($object->modified_time)) {
         $timestamp = $object->modified_time;
     }
     $path = trim($this->removePathPrefix($path), '/');
     $result = Util::map((array) $object, static::$resultMap);
     return compact('timestamp', 'path') + $result;
 }
开发者ID:nao-pon,项目名称:flysystem-copy,代码行数:20,代码来源:CopyAdapter.php

示例6: getMetadata

 /**
  * @inheritdoc
  */
 public function getMetadata($path)
 {
     $connection = $this->getConnection();
     $info = $connection->stat($path);
     if ($info === false) {
         return false;
     }
     $result = Util::map($info, $this->statMap);
     $result['type'] = $info['type'] === NET_SFTP_TYPE_DIRECTORY ? 'dir' : 'file';
     $result['visibility'] = $info['permissions'] & $this->permPublic ? 'public' : 'private';
     return $result;
 }
开发者ID:acucchieri,项目名称:flysystem-sftp,代码行数:15,代码来源:SftpAdapter.php

示例7: normalizeObject

 protected function normalizeObject($object, $path)
 {
     if (!isset($object['{DAV:}getcontentlength'])) {
         return array('type' => 'dir', 'path' => trim($path, '/'));
     }
     $result = Util::map($object, static::$resultMap);
     if (isset($object['{DAV:}getlastmodified'])) {
         $result['timestamp'] = strtotime($object['{DAV:}getlastmodified']);
     }
     $result['type'] = 'file';
     $result['path'] = trim($path, '/');
     return $result;
 }
开发者ID:simnom,项目名称:Europeana-Professional,代码行数:13,代码来源:WebDav.php

示例8: normalizeObject

 /**
  * Normalize a result from Copy.
  *
  * @param stdClass $object
  * @param string   $path
  *
  * @return array|false file metadata
  */
 protected function normalizeObject($object, $path)
 {
     if (is_a($object, 'stdClass') === false) {
         return false;
     }
     if (isset($object->modified_time)) {
         $timestamp = strtotime($object->modified_time);
     }
     $result = Util::map((array) $object, static::$resultMap);
     return compact('timestamp', 'path') + $result;
 }
开发者ID:nguyenducduy,项目名称:phblog,代码行数:19,代码来源:Copy.php

示例9: normalizeObject

 protected function normalizeObject(array $object)
 {
     if (substr($object['name'], -1) === '/') {
         return array('path' => trim($object['name'], '/'), 'type' => 'dir');
     }
     $result = array('type' => 'file');
     return array_merge($result, Util::map($object, static::$resultMap));
 }
开发者ID:luoshulin,项目名称:falcon,代码行数:8,代码来源:Zip.php

示例10: getVisibility

 /**
  * {@inheritdoc}
  */
 public function getVisibility($path)
 {
     $metadata = $this->getMetadata($path);
     return isset($metadata['visibility']) ? Util::map($metadata, ['visibility' => 'visibility']) : ['visibility' => 'public'];
 }
开发者ID:danhunsaker,项目名称:flysystem-redis,代码行数:8,代码来源:RedisAdapter.php

示例11: normalizeResponse

 /**
  * Normalize a Dropbox response.
  *
  * @param        $response
  * @param string $path
  *
  * @return array
  */
 protected function normalizeResponse(array $response, $path = null)
 {
     $result = ['path' => trim($path ?: $response['path'], '/')];
     if (isset($response['modified'])) {
         $result['timestamp'] = strtotime($response['modified']);
     }
     $result = array_merge($result, Util::map($response, static::$resultMap));
     $result['type'] = $response['is_dir'] ? 'dir' : 'file';
     return $result;
 }
开发者ID:SevenMonks,项目名称:100cities-dev,代码行数:18,代码来源:DropboxAdapter.php

示例12: normalizeObject

 /**
  * Normalize a result from Google
  *
  * @param   string  $object
  * @param   string  $path
  * @return  array   file metadata
  */
 protected function normalizeObject($object, $path = null)
 {
     $newObject = array();
     foreach ((array) $object as $key => $value) {
         if (substr($key, 0, 3) == "*") {
             $key = substr($key, 3);
         }
         $newObject[$key] = $value;
     }
     $object = $newObject;
     if (isset($object["dirname"])) {
         $result = array('path' => $object['dirname'] . "/" . $object['id']);
     } else {
         $result = array('path' => $object['id']);
     }
     if (isset($object['modifiedDate'])) {
         $result['timestamp'] = strtotime($object['modifiedDate']);
     }
     $result["basename"] = $object["title"];
     if ($object['mimeType'] == 'application/vnd.google-apps.folder') {
         $result['type'] = 'dir';
         $result['path'] = rtrim($result['path'], '/');
         $result['dirname'] = Util::dirname($result['path']);
         return $result;
     }
     $result = array_merge($result, Util::map($object, static::$resultMap), array('type' => 'file'));
     $result['dirname'] = Util::dirname($result['path']);
     if (isset($result['contents'])) {
         $result['contents'] = (string) $result['contents'];
     }
     return $result;
 }
开发者ID:xamiro-dev,项目名称:xamiro,代码行数:39,代码来源:GoogleDrive.php

示例13: listContents

 /**
  * List contents of a directory.
  *
  * @param string $directory
  * @param bool   $recursive
  *
  * @return array
  */
 public function listContents($directory = '', $recursive = false)
 {
     $results = [];
     if ($directory != '') {
         if (substr($directory, -1) != '/') {
             $directory = $directory . '/';
         }
     }
     if ($recursive == false) {
         $dirs = $this->storage->getBucket($this->bucket, $directory, null, 10000, '/');
         foreach ($dirs as $dir) {
             if (!array_key_exists('subdir', $dir)) {
                 array_push($results, Util::map($dir, ['content_type' => 'type', 'name' => 'path', 'last_modified' => 'timestamp', 'bytes' => 'size']));
             }
         }
         return $results;
     } else {
         $dirs = $this->storage->getBucket($this->bucket, $directory, null, 10000, '/');
         foreach ($dirs as $dir) {
             if (!array_key_exists('subdir', $dir)) {
                 array_push($results, Util::map($dir, ['content_type' => 'type', 'name' => 'path', 'last_modified' => 'timestamp', 'bytes' => 'size']));
             } else {
                 $results = array_merge($results, $this->listContents($dir['subdir'], true));
             }
         }
         return $results;
     }
 }
开发者ID:litp,项目名称:flysystem-sae-storage,代码行数:36,代码来源:StorageAdapter.php

示例14: normalizeObject

 /**
  * Normalize a result from AWS
  *
  * @param   array  $object
  * @param   string  $path
  * @return  array   file metadata
  */
 protected function normalizeObject(array $object, $path = null)
 {
     $result = array('path' => $path ?: $this->removePathPrefix($object['Key']));
     $result['dirname'] = Util::dirname($result['path']);
     if (isset($object['LastModified'])) {
         $result['timestamp'] = strtotime($object['LastModified']);
     }
     if (substr($result['path'], -1) === '/') {
         $result['type'] = 'dir';
         $result['path'] = rtrim($result['path'], '/');
         return $result;
     }
     $result = array_merge($result, Util::map($object, static::$resultMap), array('type' => 'file'));
     return $result;
 }
开发者ID:limweb,项目名称:webappservice,代码行数:22,代码来源:AwsS3.php


注:本文中的League\Flysystem\Util::map方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。