Commits

Thomas Weinert committed 1cc7bb6

Make requires in the examples independent from the working directory

Comments (0)

Files changed (9)

example/Http/ajax/ajax.php

 <?php
-include('../../../src/Carica/Io/Loader.php');
+include(__DIR__.'/../../../src/Carica/Io/Loader.php');
 Carica\Io\Loader::register();
 
 use Carica\Io\Network\Http;

example/Http/hello-world.php

 <?php
-include('../../src/Carica/Io/Loader.php');
+include(__DIR__.'/../../src/Carica/Io/Loader.php');
 Carica\Io\Loader::register();
 
 $server = new Carica\Io\Network\Server();

example/Http/route.php

 <?php
-include('../../src/Carica/Io/Loader.php');
+include(__DIR__.'/../../src/Carica/Io/Loader.php');
 Carica\Io\Loader::register();
 
 use Carica\Io\Network\Http;

example/MySQL/parallel.php

 <?php
-include('../../src/Carica/Io/Loader.php');
+include(__DIR__.'/../../src/Carica/Io/Loader.php');
 Carica\Io\Loader::register();
 
 use Carica\Io;

example/Serial/monitor.php

 <?php
-include('../../src/Carica/Io/Loader.php');
+include(__DIR__.'/../../src/Carica/Io/Loader.php');
 Carica\Io\Loader::register();
 
 use Carica\Io;
   }
 }
 
-include('../src/Carica/Io/Loader.php');
+include(__DIR__.'/../src/Carica/Io/Loader.php');
 Carica\Io\Loader::register();
 use Carica\Io;
 
 <?php
 
-include('../src/Carica/Io/Loader.php');
+include(__DIR__.'/../src/Carica/Io/Loader.php');
 Carica\Io\Loader::register();
 use Carica\Io\Event\Loop;
 

example/stream-read.php

 <?php
 
-include('../src/Carica/Io/Loader.php');
+include(__DIR__.'/../src/Carica/Io/Loader.php');
 Carica\Io\Loader::register();
 
 use Carica\Io\Event\Loop;
 use Carica\Io\Stream;
 
 $loop = Loop\Factory::get();
-$write = fopen('c:/temp/sample.txt', 'w');
+$write = fopen('c:/tmp/sample.txt', 'w');
 
-$stream = new Stream\File('c:/temp/sample.txt');
+$stream = new Stream\File('c:/tmp/sample.txt');
 $stream->events()->on(
   'read-data',
   function($data) {
   }
 );
 
-if ($stream->open()) {
-  $loop->setInterval(
-    function () use ($write) {
-      fwrite($write, microtime(TRUE)."\n");
-    },
-    1000
-  );
+$loop->setInterval(
+  function () use ($write) {
+    fwrite($write, microtime(TRUE)."\n");
+  },
+  1000
+);
 
-  $loop->run();
-}
+$stream->open();
+$loop->run();

example/timetalk.php

 <?php
 
-include('../src/Carica/Io/Loader.php');
+include(__DIR__.'/../src/Carica/Io/Loader.php');
 Carica\Io\Loader::register();
 use Carica\Io;