文字列を復号化します。

@param	string	$file_path	復号化するファイルのパス
@param	string	$key		復号化キー
@param	array	$options	復号化オプション
@return	string	復号化された文字列
968390
public static function DecryptMessage ($message, $key, $options = []) {
		$options['module'] = \MCRYPT_MODE_ECB;
		return static::Decrypt($message, $key, $options);
	}
893552
public function mkdir($path, $mode, $options)
    {
        if (array_has(self::$folders, $path)) {
            return true;
        }

        $parentEnd = strrpos($path, '/');
        $parent = substr($path, 0, $parentEnd);

        if (array_has(self::$folders, $parent)) {
            self::$folders[] = $path;
            return true;
        }

        if (! ($options & STREAM_MKDIR_RECURSIVE)) {
            return false;
        }

        while ($path !== self::PROTOCOL.':/') {
            if (array_has(self::$folders, $path)) {
                break;
            } else {
                self::$folders[] = $path;
            }

            $path = substr($path, 0, $parentEnd);
            $parentEnd = strrpos($path, '/');
        }

        return true;
    }
1338078
public function mkdir(string $path, int $mode, int $options): bool
    {
        $umask = vfsStream::umask();
        if (0 < $umask) {
            $permissions = $mode & ~$umask;
        } else {
            $permissions = $mode;
        }

        $path = $this->resolvePath(vfsStream::path($path));
        if (null !== $this->getContent($path)) {
            trigger_error('mkdir(): Path vfs://' . $path . ' exists', E_USER_WARNING);
            return false;
        }

        if (null === self::$root) {
            self::$root = vfsStream::newDirectory($path, $permissions);
            return true;
        }

        $maxDepth = count(explode('/', $path));
        $names    = $this->splitPath($path);
        $newDirs  = $names['basename'];
        $dir      = null;
        $i        = 0;
        while ($dir === null && $i < $maxDepth) {
            $dir     = $this->getContent($names['dirname']);
            $names   = $this->splitPath($names['dirname']);
            if (null == $dir) {
                $newDirs = $names['basename'] . '/' . $newDirs;
            }

            $i++;
        }

        if (null === $dir
          || $dir->getType() !== vfsStreamContent::TYPE_DIR
          || $dir->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()) === false) {
            return false;
        }

        $recursive = ((STREAM_MKDIR_RECURSIVE & $options) !== 0) ? (true) : (false);
        if (strpos($newDirs, '/') !== false && false === $recursive) {
            return false;
        }

        vfsStream::newDirectory($newDirs, $permissions)->at($dir);
        return true;
    }
1345505
public function addFile($filepath, $key = 'file')
    {
        $this->options = array_merge_recursive($this->options, [
            'body' => [
                $key => fopen($filepath, 'r'),
            ],
        ]);

        return $this;
    }
220715
public function mkdir($path, $mode, $options = 0)
    {
        self::restore();
        $path = self::overlayPath($path);
        $success = mkdir($path, $mode, (bool)($options & STREAM_MKDIR_RECURSIVE));
        self::register();
        return $success;
    }
1357589
public static function FileOpen ($file_path, $mode, $use_include_path = false, $context = null, $options = []) {
		//==============================================
		//オプション展開
		//==============================================
		$raise_exception	= isset($options['raise_exception']) ? $options['raise_exception'] : true;
		$name				= isset($options['name']) ? $options['name'] : '';

		if (preg_match("/[rwaxc]\+?[tb]?/", $mode) === false) {
			return CoreException::ScrubbedThrow(DirectoryStatus::NotFound('%sファイルへのストリームアクセス形式が誤っています。mode:%s, file:%s', [$name, $mode, $file_path]), $raise_exception);
		}

		$mode_set = str_split($mode);

		$valid_readable	= false;
		$valid_writable	= false;
		$valid_exists	= false;

		switch ($mode_set[0]) {
			case 'r':
				$valid_readable	= true;
				break;
			case 'x':
				$valid_exists	= true;
			case 'w':
			case 'a':
			case 'c':
				$valid_writable	= true;
				break;
			default:
				return CoreException::ScrubbedThrow(DirectoryStatus::NotFound('%sファイルへのストリームアクセス形式が誤っています。mode:%s, file:%s', [$name, $mode, $file_path]), $raise_exception);
				break;
		}

		if (isset($mode_set[1]) && $mode_set[1] === '+') {
			$valid_readable	= true;
			$valid_writable	= true;
		}

		$parent_dir = dirname($file_path);
		clearstatcache(true, $parent_dir);
		if (!file_exists($parent_dir)) {
			return CoreException::ScrubbedThrow(DirectoryStatus::NotFound('%sファイルの親ディレクトリが存在しません。file:%s', [$name, $file_path]), $raise_exception);
		}

		if (!is_readable($parent_dir)) {
			return CoreException::ScrubbedThrow(DirectoryStatus::NotFound('%sファイルの親ディレクトリを開けません。file:%s', [$name, $file_path]), $raise_exception);
		}

		clearstatcache(true, $file_path);
		$file_exists = file_exists($file_path);

		if ($valid_writable) {
			if (!is_writable($parent_dir)) {
				return CoreException::ScrubbedThrow(DirectoryStatus::NotFound('%sファイルの親ディレクトリに書き込み権がありません。。file:%s', [$name, $file_path]), $raise_exception);
			}

			if ($valid_exists) {
				if ($file_exists) {
					return CoreException::ScrubbedThrow(DirectoryStatus::NotFound('%sファイルが既に存在しています。file:%s', [$name, $file_path]), $raise_exception);
				}
			}
			if ($file_exists && !is_writable($file_path)) {
				return CoreException::ScrubbedThrow(DirectoryStatus::NotFound('%sファイルに対する書き込み権がありません。file:%s', [$name, $file_path]), $raise_exception);
			}
		}

		if ($valid_readable) {
			if (!$file_exists) {
				return CoreException::ScrubbedThrow(DirectoryStatus::NotFound('%sファイルが存在しません。file:%s', [$name, $file_path]), $raise_exception);
			}

			if (!is_readable($file_path)) {
				return CoreException::ScrubbedThrow(DirectoryStatus::NotFound('%sファイルに対する読み込み権がありません。file:%s', [$name, $file_path]), $raise_exception);
			}
		}

		return $context === null ? fopen($file_path, $mode, $use_include_path) : fopen($file_path, $mode, $use_include_path, $context);
	}
588906
function simpleFilePath( $fileKey )
    {
        if ( !isset( $this->Parameters['simple-file-list'] ) )
        {
            return false;
        }
        if ( !isset( $this->Parameters['simple-file-list'][$fileKey] ) )
        {
            return false;
        }

        return $this->path() . '/' . $this->Parameters['simple-file-list'][$fileKey]['package-path'];
    }
748867
public static function Decrypt ($data, $key, $options = []) {
		$options = static::_AdjustOptions($options);
		return openssl_decrypt($data, $options['method'], $key, $options['openssl_options'], $options['iv']);
	}
606061
public function readFile($filePath = null, array $options = [])
    {
        $filePath = empty($filePath)
            ? $this->filePath
            : $filePath;

        $defaultOptions = [
            'length'    => 1000,
            'delimiter' => ',',
        ];

        $options = array_merge($defaultOptions, $options);

        $result = [];

        if (false !== ($handle = fopen($filePath, 'r'))) {
            while (false !== ($data = fgetcsv($handle, $options[ 'length' ], $options[ 'delimiter' ]))) {
                $result[] = fgetcsv($handle);
            }
        }

        return $result;
    }
1102805
public function stream_open($url, $mode, $options, &$openedPath)
  {
    $partition = self::getPartition($url);
    $path = self::getRelativePath($url);

    $this->_filePointer = $partition->fileOpen(
      $path, $mode, $options, $this->_fileEntity
    );

    $result = !!$this->_filePointer;
    if ($result && ($options & STREAM_USE_PATH)) {
      $openedPath = $path;
    }
    return $result;
  }
1277682
public function t($key, array $options = [], $locale = null)
    {
        return $this->translate($key, $options, $locale);
    }
850933
public function file($name, array $options = [])
    {
        return $this->form->file($name, $this->addFormControlClass($this->getFieldOptions($name, $options)));
    }
178744
public static function pathModeInfo(string $file_path): int
    {
        /* 如果不存在，则不可读、不可写、不可改 */
        if (!file_exists($file_path)) {
            return false;
        }

        $mark = 0;

        if (0 === stripos(PHP_OS, 'WIN')) {
            /* 测试文件 */
            $test_file = $file_path . '/cf_test.txt';

            /* 如果是目录 */
            if (is_dir($file_path)) {
                /* 检查目录是否可读 */
                $dir = @opendir($file_path);

                //如果目录打开失败，直接返回目录不可修改、不可写、不可读
                if ($dir === false) {
                    return $mark;
                }

                //目录可读 001，目录不可读 000
                if (@readdir($dir) !== false) {
                    $mark ^= 1;
                }

                @closedir($dir);

                /* 检查目录是否可写 */
                $fp = @fopen($test_file, 'wb');

                //如果目录中的文件创建失败，返回不可写。
                if ($fp === false) {
                    return $mark;
                }

                //目录可写可读 011，目录可写不可读 010
                if (@fwrite($fp, 'directory access testing.') !== false) {
                    $mark ^= 2;
                }

                @fclose($fp);
                @unlink($test_file);

                /* 检查目录是否可修改 */
                $fp = @fopen($test_file, 'ab+');
                if ($fp === false) {
                    return $mark;
                }

                if (@fwrite($fp, "modify test.\r\n") !== false) {
                    $mark ^= 4;
                }

                @fclose($fp);

                /* 检查目录下是否有执行rename()函数的权限 */
                if (@rename($test_file, $test_file) !== false) {
                    $mark ^= 8;
                }

                @unlink($test_file);

                /* 如果是文件 */
            } elseif (is_file($file_path)) {
                /* 以读方式打开 */
                $fp = @fopen($file_path, 'rb');
                if ($fp) {
                    $mark ^= 1; //可读 001
                }

                @fclose($fp);

                /* 试着修改文件 */
                $fp = @fopen($file_path, 'ab+');
                if ($fp && @fwrite($fp, '') !== false) {
                    $mark ^= 6; //可修改可写可读 111，不可修改可写可读011...
                }

                @fclose($fp);

                /* 检查目录下是否有执行rename()函数的权限 */
                if (@rename($test_file, $test_file) !== false) {
                    $mark ^= 8;
                }
            }
        } else {
            if (@is_readable($file_path)) {
                $mark ^= 1;
            }

            if (@is_writable($file_path)) {
                $mark ^= 14;
            }
        }

        return $mark;
    }
568093
protected function putIntoFile($file_path, $data)
    {
        if ($this->files->isDirectory($this->files->dirname($file_path))) {
            $data = str_replace(["\n", "\r"], '', trim((string) $data));

            return $this->files->put($file_path, $data, $this->use_locking) > 0;
        }

        // @codeCoverageIgnoreStart
        return false;
        // @codeCoverageIgnoreEnd
    }
642807
public static function Decrypt ($data, $key, $options = []) {
		$options = static::_AdjustOptions($options);
		$td = static::_OpenMcrypt($key, $options);
		$data = @mdecrypt_generic($td, $data);
		static::_CloseMcrypt($td);

		$pad = ord($data{strlen($data) - 1});
		if ($pad > strlen($data)) {
			return false;
		}

		if (strspn($data, chr($pad), strlen($data) - $pad) != $pad) {
			return false;
		}

		return substr($data, 0, -1 * $pad);
	}
118604
static public function acquire($key, $options = [])
    {
        $keyMD5 = md5(self::$keyPrefix . serialize($key));
        $timeout = isset($options['timeout']) ? (float) $options['timeout'] : self::$defaultLockTimeout;
        $retryInterval = 0.5;
        $maxRetriesCount = floor($timeout / $retryInterval);
        $lock = function() use ($keyMD5) {
            if (!isset(self::$data[$keyMD5])) {
                set_error_handler(function($errno, $errstr) {
                    throw new \Exception($errstr);
                });
                $dir = self::getLocksDir();
                if (!is_dir($dir)) {
                    try {
                        mkdir($dir, 0777, true);
                    } catch (\Exception $e) {
                        if ($e->getMessage() !== 'mkdir(): File exists') { // The directory may be just created in other process.
                            restore_error_handler();
                            return false;
                        }
                    }
                }
                $filename = $dir . $keyMD5 . '.lock';
                try {
                    $filePointer = fopen($filename, "w");
                    if ($filePointer !== false && flock($filePointer, LOCK_EX | LOCK_NB) !== false) {
                        self::$data[$keyMD5] = $filePointer;
                        restore_error_handler();
                        return true;
                    }
                } catch (\Exception $e) {
                    
                }
                restore_error_handler();
                return false;
            }
            return false;
        };
        $startTime = microtime(true);
        for ($i = 0; $i < $maxRetriesCount + 1; $i++) {
            if ($lock()) {
                return;
            }
            if (microtime(true) - $startTime > $timeout) {
                break;
            }
            usleep($retryInterval * 1000000);
        }
        throw new \Exception('Cannot acquire lock for "' . $key . '"');
    }
444270
private function getSubPath(string $path, $key, bool $isArray): string
    {
        $key = (string) $key;

        if ($isArray) {
            return $path.'['.$key.']';
        }

        return '' !== $path ? $path.'.'.$key : $key;
    }