Skip to content

Instantly share code, notes, and snippets.

Created September 14, 2014 13:27

Revisions

  1. @invalid-email-address Anonymous created this gist Sep 14, 2014.
    30 changes: 30 additions & 0 deletions test.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    <?php

    require 'vendor/autoload.php';

    $loop = \React\EventLoop\Factory::create();
    $filesystem = new \React\Filesystem\Filesystem($loop);
    $loop->addTimer(0.0001, function() use ($filesystem) {
    $file = $filesystem->file(__FILE__);
    $file->exists()->then(function() use ($file) {
    echo __FILE__ . ' exists', PHP_EOL;
    $file->size()->then(function($size) use ($file) {
    var_export($size);
    echo PHP_EOL;
    $file->time()->then(function($time) {
    var_export($time);
    echo PHP_EOL;g
    });
    });
    });
    $rm = $filesystem->file('./test_rm');
    $rm->exists()->then(function() use ($rm) {
    $rm->remove()->then(function() {
    echo 'test_rm removed', PHP_EOL;
    }, function() {
    echo 'test_rm note removed', PHP_EOL;
    });
    });
    });

    $loop->run();