public function __construct($output)
 {
     // parse the output as path name (just in case someone called
     // the constructor with an absolute path instead of a relative path)
     $path = new Yothalot\Path($output);
     // store
     $this->output = $path->relative();
 }
 *  @copyright 2015 Copernica BV
 *  @documentation private
 */
/**
 *  Dependencies
 */
require_once 'LineCount.php';
/**
 *  The WordCount class wrote its output to a file on the distributed file
 *  system. To find out what the absolute path name of this file is on this
 *  machine, we make use of the Yothalot\Path class to turn the relative name
 *  into an absolute path (GlusterFS must be mounted on this machine)
 *
 *  @var Yothalot\Path
 */
$path = new Yothalot\Path("linecount-results.txt");
/**
 *  Unlink the result upon start, to make sure that we don't display the previous result.
 */
unlink($path->absolute());
/**
 *  Create an instance of the WordCount algorithm
 *  @var WordCount
 */
$wordcount = new LineCount($path->relative());
/**
 *  We want to send this WordCount instance to the Yothalot master. To do this,
 *  we need an instance of this master object.
 *
 *  (Under the hood, you do not connect with the Yothalot master process, but to
 *  a RabbitMQ message queue, the login details are therefore the RabbitMQ
<?php

/**
 *  Dependencies
 */
require_once 'KvWordCount.php';
/**
 *  The WordCount class wrote its output to a file on the distributed file
 *  system. To find out what the absolute path name of this file is on this
 *  machine, we make use of the Yothalot\Path class to turn the relative name
 *  into an absolute path (GlusterFS must be mounted on this machine)
 *
 *  @var Yothalot\Path
 */
$path = new Yothalot\Path("wordcount-results.txt");
/**
 *  Create an instance of the WordCount algorithm
 *  @var WordCount
 */
$wordcount = new KvWordCount($path->relative());
/**
 *  We want to send this WordCount instance to the Yothalot connection. To do this,
 *  we need an instance of the connection to Yothalot.
 *
 *  (Under the hood, you do not connect with the Yothalot master process, but to
 *  a RabbitMQ message queue, the login details are therefore the RabbitMQ
 *  details)
 *
 *  @var Yothalot\Connect
 */
$connection = new Yothalot\Connection();
 /**
  *  The final step in the reducer process calls the write() method once for
  *  every found key, and for each reduced value.
  *
  *  In this specific WordCount example, the key is a word, and the
  *  value the total number of occurances
  *
  *  @param  mixed       The key for which the result comes in
  *  @param  mixed       Fully reduced value
  */
 function write($key, $value)
 {
     // the output file is stored on the gluster
     $path = new Yothalot\Path($this->output);
     // write the key value pair to a file
     file_put_contents($path->absolute(), "{$key}: {$value}\n", FILE_APPEND);
 }
<?php

/**
 *  Dependencies
 */
require_once 'KvChainedLineCount.php';
require_once 'Merger.php';
/**
 *  This should be 3x the linecount-results by definition, because
 *  multiple inputs are being used.
 *
 *  @var Yothalot\Path
 */
$path = new Yothalot\Path("linecount-results-3.txt");
/**
 *  Unlink the result upon start, to make sure that we don't display the previous result.
 */
unlink($path->absolute());
/**
 *  Create an instance of the merger
 *  @var Merger
 */
$merger = new Merger($path->relative());
/**
 *  We want to send this WordCount instance to the Yothalot connection. To do this,
 *  we need an instance of the connection to Yothalot.
 *
 *  (Under the hood, you do not connect with the Yothalot master process, but to
 *  a RabbitMQ message queue, the login details are therefore the RabbitMQ
 *  details)
 *
 /**
  *  The final step in the reducer process calls the write() method once for
  *  every found key, and for each reduced value.
  *
  *  In this specific WordCount example, the key is a word, and the
  *  value the total number of occurances
  *
  *  @param  mixed       The key for which the result comes in
  *  @param  mixed       Fully reduced value
  */
 function write($key, $value)
 {
     // the output file is stored on the gluster
     $path = new Yothalot\Path($this->output);
     // open an output file
     $output = new Yothalot\Output($path->absolute());
     // add the key and value
     $output->kv($key, $value);
 }
 /**
  *  The final step in the reducer process calls the write() method once for
  *  every found key, and for each reduced value.
  *
  *  In this specific WordCount example, the key is a word, and the
  *  value the total number of occurrences
  *
  *  @param  mixed       The key for which the result comes in
  *  @param  mixed       Fully reduced value
  */
 public function write($key, $value)
 {
     // if we've not added the file yet
     if (!$this->file) {
         // the output file is stored on the gluster
         $path = new Yothalot\Path($this->output);
         // open the file
         $this->file = fopen($path->absolute(), "w+");
     }
     // write to the file
     fwrite($this->file, "{$key}: {$value}\n");
 }