<commit_before><?php
/**
 * This is a generated class - DO NOT EDIT.
 */
namespace ${actorNs};

use \zpt\rest\BaseRequestHandler;
use \zpt\rest\RequestHandler;
use \zpt\rest\Request;
use \zpt\rest\Response;
use \zpt\cdt\di\Injector;
use \zpt\cdt\rest\BeanRequestHandler;
use \Exception;

class ${actorClass} extends BaseRequestHandler implements BeanRequestHandler {

  private $service;
  private $session;
  private $mappings;
  private $pdo;

  public function __construct() {
    $this->mappings = ${php:mappings};
  }

  public function getMappings() {
    return $this->mappings;
  }

  public function setService($service) {
    $this->service = $service;
  }

  public function setSession($session) {
    $this->session = $session;
  }

  public function setPdo($pdo) {
    $this->pdo = $pdo;
  }

  ${each:methodTypes as methodType}
    public function ${methodType[type]}(Request $request, Response $response) {
      try {
        $this->pdo->beginTransaction();

        $mappingId = $request->getMappingId();
        switch ($mappingId) {

          ${each:methodType[methods] as method}
            case '${method[name]}':
            ${if:method[enforceOrder]}
              if ($request->hasData('__ROT')) {
                $rot = $request->getData('__ROT');
                $uriHash = 'rot-' . $request->getUri();
                $curRot = $this->session->get($uriHash);
                if ($curRot === null || $curRot < $rot) {
                  $this->session->set($uriHash, $rot);
                } else {
                  $response->setData(array(
                    'success' => null
                  ));
                }
              }

            ${fi}
            $this->service->${method[name]}($request, $response);
            $this->pdo->commit();
            return;

          ${done}
        }
        parent::${methodType[type]}($request, $response);
      } catch (Exception $e) {
        $this->pdo->rollback();
        throw $e;
      }
    }
  ${fi}
}<commit_msg>Updated service request dispatcher template to use code-templates v2 syntax<commit_after><?php
/**
 * This is a generated class - DO NOT EDIT.
 */
namespace /*# actorNs #*/;

use \zpt\rest\BaseRequestHandler;
use \zpt\rest\RequestHandler;
use \zpt\rest\Request;
use \zpt\rest\Response;
use \zpt\cdt\di\Injector;
use \zpt\cdt\rest\BeanRequestHandler;
use \Exception;

class /*# actorClass #*/ extends BaseRequestHandler implements BeanRequestHandler {

  private $service;
  private $session;
  private $mappings;
  private $pdo;

  public function __construct() {
    $this->mappings = /*# php:mappings #*/;
  }

  public function getMappings() {
    return $this->mappings;
  }

  public function setService($service) {
    $this->service = $service;
  }

  public function setSession($session) {
    $this->session = $session;
  }

  public function setPdo($pdo) {
    $this->pdo = $pdo;
  }

  #{ each methodTypes as methodType
    public function /*# methodType[type] #*/(Request $request, Response $response) {
      try {
        $this->pdo->beginTransaction();

        $mappingId = $request->getMappingId();
        switch ($mappingId) {

          #{ each methodType[methods] as method
            case '/*# method[name] #*/':
            #{ if method[enforceOrder]
              if ($request->hasData('__ROT')) {
                $rot = $request->getData('__ROT');
                $uriHash = 'rot-' . $request->getUri();
                $curRot = $this->session->get($uriHash);
                if ($curRot === null || $curRot < $rot) {
                  $this->session->set($uriHash, $rot);
                } else {
                  $response->setData(array(
                    'success' => null
                  ));
                }
              }

            #}
            $this->service->/*# method[name] #*/($request, $response);
            $this->pdo->commit();
            return;

          #}
        }
        parent::/*# methodType[type] #*/($request, $response);
      } catch (Exception $e) {
        $this->pdo->rollback();
        throw $e;
      }
    }
  #}
}
{'fraction_non_alphanumeric': 0.15690580771107857, 'fraction_numerical': 0.0002440214738897023, 'mean_word_length': 2.0430586488492946, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5992813', 'n_tokens_mistral': 1263, 'n_tokens_neox': 1227, 'n_words': 254}