<?php

namespace Drupal\restaurant\Helper;

use Drupal\restaurant\Registry\Registry;
use Drupal\restaurant\Call\Call;


abstract class Helper
{
  protected $modulePath = '';

  protected $basePath = '';

  public function __construct()
  {
    $registry = Registry::getInstance();
    $this->modulePath = $registry->modulePath;
    require_once $this->modulePath . 'restaurant' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Call' . DIRECTORY_SEPARATOR . 'Call.php'; //todo - get  this class to autoload


  }

  public function __call($func, $args)
  {
    $call = new Call();
    return $call->get($func, $args);
  }

  public function htmlAttributes(array $arg = array())
  {
    $str = '';
    foreach ($arg as $key => $val) {
      $str .= ' ' . $key . '="' . $val . '" ';
    }
    return $str;
  }
}
