/** * {@inheritdoc} */ public function stat($path) { $this->incrementPending(); $promisor = new Deferred(); $priority = \EIO_PRI_DEFAULT; \eio_stat($path, $priority, [$this, "onStat"], $promisor); return $promisor->promise(); }
/** * Gets stat() information * @param string $path Path * @param callable $cb Callback * @param integer $pri Priority * @return resource|true */ public static function stat($path, $cb, $pri = EIO_PRI_DEFAULT) { $cb = CallbackWrapper::forceWrap($cb); if (!self::$supported) { call_user_func($cb, $path, FileSystem::statPrepare(@stat($path))); return true; } return eio_stat($path, $pri, function ($path, $stat) use($cb) { call_user_func($cb, $path, FileSystem::statPrepare($stat)); }, $path); }
public static function stat($path, $cb, $pri = EIO_PRI_DEFAULT) { if (!self::$supported) { call_user_func($cb, $path, FS::statPrepare(stat($path))); return; } return eio_stat($path, $pri, function ($path, $stat) use($cb) { call_user_func($cb, $path, FS::statPrepare($stat)); }, $path); }
/** * {@inheritdoc} */ public function stat(string $path) : \Generator { $delayed = new Delayed(); \eio_stat($path, null, function (Delayed $delayed, $result, $req) { if (-1 === $result) { $delayed->reject(new FileException(sprintf('Could not stat file: %s.', \eio_get_last_error($req)))); } else { $delayed->resolve($result); } }, $delayed); $this->poll->listen(); try { $stat = (yield $delayed); } finally { $this->poll->done(); } $numeric = []; foreach (self::getStatKeys() as $key => $name) { $numeric[$key] = $stat[$name]; } return array_merge($numeric, $stat); }
/** * {@inheritdoc} */ public function stat($path) { if ($stat = StatCache::get($path)) { return new Success($stat); } \call_user_func($this->incrementor, 1); $promisor = new Deferred(); $priority = \EIO_PRI_DEFAULT; $data = [$promisor, $path]; \eio_stat($path, $priority, [$this, "onStat"], $data); return $promisor->promise(); }