/**
  * Calls trigger_error(), printing the appropriate message.
  *
  * @param string     $function
  * @param \Exception $e
  */
 protected function triggerError($function, \Exception $e)
 {
     if ($e instanceof TriggerErrorException) {
         trigger_error($e->formatMessage($function), E_USER_WARNING);
         return;
     }
     switch (get_class($e)) {
         case 'League\\Flysystem\\FileNotFoundException':
             trigger_error(sprintf('%s(): No such file or directory', $function), E_USER_WARNING);
             return;
         case 'League\\Flysystem\\RootViolationException':
             trigger_error(sprintf('%s(): Cannot remove the root directory', $function), E_USER_WARNING);
             return;
     }
     // Don't allow any exceptions to leak.
     trigger_error($e->getMessage(), E_USER_WARNING);
 }