]> Kevux Git Server - koopa/commitdiff
Cleanup: prefix private constants with 'p_'
authorKevin Day <thekevinday@gmail.com>
Wed, 14 Feb 2018 00:32:34 +0000 (18:32 -0600)
committerKevin Day <thekevinday@gmail.com>
Wed, 14 Feb 2018 00:32:34 +0000 (18:32 -0600)
I have mixed feelings about this, but it makes the behavior of prefixing p_ to private class parts and pr_ to protected class parts.
Stick to lower case for the prefix but continue to use upper case for the constant name.

common/base/classes/base_path.php
common/theme/classes/theme_html.php

index ec8926af1d3165ad1968c4f09499dda3a0464b64..10545a001a03ac8b720e5f4fb3d844a3009295d2 100644 (file)
@@ -65,14 +65,14 @@ require_once('common/base/classes/base_array.php');
 class c_base_path extends c_base_rfc_string {
   use t_base_return_value_exact;
 
-  private const DEFAULT_ALLOWED_METHODS = [
+  private const p_DEFAULT_ALLOWED_METHODS = [
     c_base_http::HTTP_METHOD_GET => c_base_http::HTTP_METHOD_GET,
     c_base_http::HTTP_METHOD_POST => c_base_http::HTTP_METHOD_POST,
     c_base_http::HTTP_METHOD_HEAD => c_base_http::HTTP_METHOD_HEAD,
     c_base_http::HTTP_METHOD_OPTIONS => c_base_http::HTTP_METHOD_OPTIONS,
   ];
 
-  private const DEFAULT_SANITIZE_HTML = [
+  private const p_DEFAULT_SANITIZE_HTML = [
     'flags' => ENT_HTML5 | ENT_NOQUOTES | ENT_DISALLOWED | ENT_SUBSTITUTE,
     'encoding' => 'UTF-8',
   ];
@@ -131,8 +131,8 @@ class c_base_path extends c_base_rfc_string {
     $this->include_directory = NULL;
     $this->include_name      = NULL;
 
-    $this->allowed_methods = self::DEFAULT_ALLOWED_METHODS;
-    $this->sanitize_html   = self::DEFAULT_SANITIZE_HTML;
+    $this->allowed_methods = self::p_DEFAULT_ALLOWED_METHODS;
+    $this->sanitize_html   = self::p_DEFAULT_SANITIZE_HTML;
 
     $this->path_tree = NULL;
   }
@@ -690,7 +690,7 @@ class c_base_path extends c_base_rfc_string {
     }
 
     if (!is_array($this->sanitize_html)) {
-      $this->sanitize_html = static::DEFAULT_SANITIZE_HTML;
+      $this->sanitize_html = static::p_DEFAULT_SANITIZE_HTML;
     }
 
     if (!is_null($flags)) {
@@ -941,7 +941,7 @@ class c_base_path extends c_base_rfc_string {
    */
   public function get_allowed_methods() {
     if (!is_array($this->allowed_methods)) {
-      $this->allowed_methods = static::DEFAULT_ALLOWED_METHODS;
+      $this->allowed_methods = static::p_DEFAULT_ALLOWED_METHODS;
     }
 
     return c_base_return_array::s_new($this->allowed_methods);
@@ -958,7 +958,7 @@ class c_base_path extends c_base_rfc_string {
    */
   public function get_sanitize_html() {
     if (!is_array($this->sanitize_html)) {
-      $this->sanitize_html = static::DEFAULT_SANITIZE_HTML;
+      $this->sanitize_html = static::p_DEFAULT_SANITIZE_HTML;
     }
 
     return c_base_return_array::s_new($this->sanitize_html);
index 5fd46e40a022915a7681661f69802be34cde3e8e..b2c05890fd168a4727c2dc4183f8533facdaa0b6 100644 (file)
@@ -28,7 +28,7 @@ require_once('common/base/classes/base_mime.php');
 class c_theme_html extends c_base_return {
   const DEFAULT_MAX_RECURSION_DEPTH = 16384;
 
-  private const DEFAULT_SANITIZE_HTML = [
+  private const p_DEFAULT_SANITIZE_HTML = [
     'flags' => ENT_HTML5 | ENT_NOQUOTES | ENT_DISALLOWED | ENT_SUBSTITUTE,
     'encoding' => 'UTF-8',
     'double_encode' => FALSE,
@@ -6483,7 +6483,7 @@ class c_theme_html extends c_base_return {
   private function p_html_entities_tag($tag) {
     $text = $tag->get_text()->get_value_exact();
     if ($tag->get_encode_text()->get_value_exact()) {
-      return htmlentities($text, self::DEFAULT_SANITIZE_HTML['flags'], self::DEFAULT_SANITIZE_HTML['encoding'], self::DEFAULT_SANITIZE_HTML['double_encode']);
+      return htmlentities($text, self::p_DEFAULT_SANITIZE_HTML['flags'], self::p_DEFAULT_SANITIZE_HTML['encoding'], self::p_DEFAULT_SANITIZE_HTML['double_encode']);
     }
 
     return $text;