<?php

class CaesarCipher extends SimpleCipher
{
  public function __construct()
  {
    $alpha = strtoupper("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
    $alpha .= $alpha.strtolower($alpha)."0123456789";
    $beta = strrev($alpha);

    for($i=0;$i<strlen($alpha);$i++)
    {
      $this->secret_encrypt[$alpha[$i]] = $beta[$i];
      $this->secret_decrpyt[$beta[$i]] = $alpha[$i];
    }
  }

  private static $instance = null;

  public static function enc($text)
  {
    if(self::$instance == null)
      self::$instance = new CaesarCipher();
    return self::$instance->encrypt($text);
  }
  public static function dec($encrypted)
  {
    if(self::$instance == null)
      self::$instance = new CaesarCipher();
    return self::$instance->decrypt($encrypted);
  }
}