Completed
Branch dev (11654d)
by
unknown
06:28
created
development/factory/_common/utility/AdminPageFramework_Debug.php 3 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -140,6 +140,7 @@  discard block
 block discarded – undo
140 140
          * Determines the log file path.
141 141
          * @since       3.5.3 
142 142
          * @internal    
143
+         * @param string|null $bsFilePath
143 144
          * @return      string      The path of the file to log the contents.
144 145
          */
145 146
         static private function _getLogFilePath( $bsFilePath, $sCallerClass ) {
@@ -194,6 +195,7 @@  discard block
 block discarded – undo
194 195
              * Returns a length of a value.
195 196
              * @since       3.5.3
196 197
              * @internal
198
+             * @param string $sVariableType
197 199
              * @return      integer|null        For string or integer, the string length. For array, the element lengths. For other types, null.
198 200
              */
199 201
             static private function _getValueLength( $mValue, $sVariableType ) {
@@ -211,6 +213,8 @@  discard block
 block discarded – undo
211 213
          * Returns the heading part of a log item.
212 214
          * @since       3.5.3
213 215
          * @internal
216
+         * @param double $fCurrentTimeStamp
217
+         * @param double $nElapsed
214 218
          * @return      string      the heading part of a log item.
215 219
          */
216 220
         static private function _getLogHeadingLine( $fCurrentTimeStamp, $nElapsed, $sCallerClass, $sCallerFunction ) {
@@ -418,6 +422,7 @@  discard block
 block discarded – undo
418 422
             }
419 423
         /**
420 424
          * Performs `array_map()` recursively.
425
+         * @param string[] $oCallable
421 426
          * @return      array.
422 427
          * @since       3.8.9
423 428
          */
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * @param       string          $sFilePath      The file path for a log file.
34 34
      * @return      void
35 35
      */
36
-    static public function dump( $asArray, $sFilePath=null ) {
36
+    static public function dump( $asArray, $sFilePath = null ) {
37 37
         echo self::get( $asArray, $sFilePath );
38 38
     }    
39 39
         /**
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
          * @since unknown
45 45
          * @deprecated      3.2.0
46 46
          */
47
-        static public function dumpArray( $asArray, $sFilePath=null ) {
47
+        static public function dumpArray( $asArray, $sFilePath = null ) {
48 48
             self::dump( $asArray, $sFilePath );
49 49
         }    
50 50
         
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      * @param       string          $sFilePath      The file path for a log file.
60 60
      * @param       boolean         $bEscape        Whether to escape characters.
61 61
      */
62
-    static public function get( $asArray, $sFilePath=null, $bEscape=true ) {
62
+    static public function get( $asArray, $sFilePath = null, $bEscape = true ) {
63 63
 
64 64
         if ( $sFilePath ) {
65 65
             self::log( $asArray, $sFilePath );     
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
          * @since       3.0.0 Changed the $bEncloseInTag parameter to bEscape.
82 82
          * @deprecated  3.2.0
83 83
          */
84
-        static public function getArray( $asArray, $sFilePath=null, $bEscape=true ) {
85
-            self::showDeprecationNotice( __CLASS__ .'::' . __FUNCTION__,  __CLASS__ .'::get()' );
84
+        static public function getArray( $asArray, $sFilePath = null, $bEscape = true ) {
85
+            self::showDeprecationNotice( __CLASS__.'::'.__FUNCTION__, __CLASS__.'::get()' );
86 86
             return self::get( $asArray, $sFilePath, $bEscape );
87 87
         }      
88 88
             
@@ -104,18 +104,18 @@  discard block
 block discarded – undo
104 104
      * @param       string      $sFilePath      The log file path.
105 105
      * @return      void
106 106
      **/
107
-    static public function log( $mValue, $sFilePath=null ) {
107
+    static public function log( $mValue, $sFilePath = null ) {
108 108
                 
109 109
         static $_fPreviousTimeStamp = 0;
110 110
         
111 111
         $_oCallerInfo       = debug_backtrace();
112 112
         $_sCallerFunction   = self::getElement(
113
-            $_oCallerInfo,  // subject array
113
+            $_oCallerInfo, // subject array
114 114
             array( 1, 'function' ), // key
115 115
             ''      // default
116 116
         );                        
117
-        $_sCallerClass      = self::getElement(
118
-            $_oCallerInfo,  // subject array
117
+        $_sCallerClass = self::getElement(
118
+            $_oCallerInfo, // subject array
119 119
             array( 1, 'class' ), // key
120 120
             ''      // default
121 121
         );           
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
125 125
             self::_getLogFilePath( $sFilePath, $_sCallerClass ), 
126 126
             self::_getLogHeadingLine( 
127 127
                 $_fCurrentTimeStamp,
128
-                round( $_fCurrentTimeStamp - $_fPreviousTimeStamp, 3 ),     // elapsed time
128
+                round( $_fCurrentTimeStamp - $_fPreviousTimeStamp, 3 ), // elapsed time
129 129
                 $_sCallerClass,
130 130
                 $_sCallerFunction
131
-            ) . PHP_EOL
131
+            ).PHP_EOL
132 132
             . self::_getLogContents( $mValue ),
133 133
             FILE_APPEND 
134 134
         );     
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
             }
151 151
             // Return a generated default log path.
152 152
             if ( true === $bsFilePath ) {
153
-                return WP_CONTENT_DIR . DIRECTORY_SEPARATOR . basename( get_class() ) . '_' . date( "Ymd" ) . '.log';
153
+                return WP_CONTENT_DIR.DIRECTORY_SEPARATOR.basename( get_class() ).'_'.date( "Ymd" ).'.log';
154 154
             }
155
-            return WP_CONTENT_DIR . DIRECTORY_SEPARATOR . basename( get_class() ) . '_' . basename( $sCallerClass ) . '_' . date( "Ymd" ) . '.log';
155
+            return WP_CONTENT_DIR.DIRECTORY_SEPARATOR.basename( get_class() ).'_'.basename( $sCallerClass ).'_'.date( "Ymd" ).'.log';
156 156
             
157 157
         }
158 158
             /**
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
              * @internal
162 162
              */
163 163
             static private function _createFile( $sFilePath ) {
164
-                if ( ! $sFilePath || true === $sFilePath ) {
164
+                if ( !$sFilePath || true === $sFilePath ) {
165 165
                     return false;
166 166
                 }
167 167
                 if ( file_exists( $sFilePath ) ) {
@@ -184,10 +184,10 @@  discard block
 block discarded – undo
184 184
             $_iLengths  = self::_getValueLength( $mValue, $_sType );
185 185
             return '(' 
186 186
                 . $_sType
187
-                . ( null !== $_iLengths ? ', length: ' . $_iLengths : '' )
187
+                . ( null !== $_iLengths ? ', length: '.$_iLengths : '' )
188 188
             . ') '
189 189
             . self::getAsString( $mValue ) 
190
-            . PHP_EOL . PHP_EOL;
190
+            . PHP_EOL.PHP_EOL;
191 191
         
192 192
         }      
193 193
             /**
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
             $_nMicroseconds     = str_pad( round( ( $_nNow - floor( $_nNow ) ) * 10000 ), 4, '0' );
229 229
             
230 230
             $_aOutput           = array(
231
-                date( "Y/m/d H:i:s", $_nNow ) . '.' . $_nMicroseconds,
231
+                date( "Y/m/d H:i:s", $_nNow ).'.'.$_nMicroseconds,
232 232
                 self::_getFormattedElapsedTime( $nElapsed ),
233 233
                 $_iPageLoadID,
234 234
                 AdminPageFramework_Registry::getVersion(),
235
-                $sCallerClass . '::' . $sCallerFunction,
235
+                $sCallerClass.'::'.$sCallerFunction,
236 236
                 current_filter(),
237 237
                 self::getCurrentURL(),
238 238
             );
@@ -250,22 +250,22 @@  discard block
 block discarded – undo
250 250
                 $_aElapsedParts     = explode( ".", ( string ) $nElapsed );
251 251
                 $_sElapsedFloat     = str_pad(
252 252
                     self::getElement(
253
-                        $_aElapsedParts,  // subject array
253
+                        $_aElapsedParts, // subject array
254 254
                         1, // key
255 255
                         0      // default
256 256
                     ),      
257 257
                     3, 
258 258
                     '0'
259 259
                 );
260
-                $_sElapsed          = self::getElement(
261
-                    $_aElapsedParts,  // subject array
262
-                    0,  // key
260
+                $_sElapsed = self::getElement(
261
+                    $_aElapsedParts, // subject array
262
+                    0, // key
263 263
                     0   // default
264 264
                 );                                   
265
-                $_sElapsed          = strlen( $_sElapsed ) > 1 
266
-                    ? '+' . substr( $_sElapsed, -1, 2 ) 
267
-                    : ' ' . $_sElapsed;
268
-                return $_sElapsed . '.' . $_sElapsedFloat;
265
+                $_sElapsed = strlen( $_sElapsed ) > 1 
266
+                    ? '+'.substr( $_sElapsed, -1, 2 ) 
267
+                    : ' '.$_sElapsed;
268
+                return $_sElapsed.'.'.$_sElapsedFloat;
269 269
             
270 270
             }
271 271
         /**
@@ -275,8 +275,8 @@  discard block
 block discarded – undo
275 275
          * @since       3.0.3   Changed the default log location and file name.
276 276
          * @deprecated  3.1.0   Use the `log()` method instead.
277 277
          */
278
-        static public function logArray( $asArray, $sFilePath=null ) {
279
-            self::showDeprecationNotice( __CLASS__ .'::' . __FUNCTION__,  __CLASS__ .'::log()' );
278
+        static public function logArray( $asArray, $sFilePath = null ) {
279
+            self::showDeprecationNotice( __CLASS__.'::'.__FUNCTION__, __CLASS__.'::log()' );
280 280
             self::log( $asArray, $sFilePath );     
281 281
         }      
282 282
         
@@ -300,20 +300,20 @@  discard block
 block discarded – undo
300 300
          */
301 301
         static private function _getLegibleCallable( $asoCallable ) {
302 302
             
303
-            if ( ! is_callable( $asoCallable ) ) {
303
+            if ( !is_callable( $asoCallable ) ) {
304 304
                 return $asoCallable;
305 305
             }
306 306
             if ( is_string( $asoCallable ) ) {
307
-                return '(callable) ' . $asoCallable;
307
+                return '(callable) '.$asoCallable;
308 308
             }
309 309
             if ( is_object( $asoCallable ) ) {
310
-                return '(callable) ' . get_class( $asoCallable );
310
+                return '(callable) '.get_class( $asoCallable );
311 311
             }
312 312
             $_sSubject = is_object( $asoCallable[ 0 ] )
313 313
                 ? get_class( $asoCallable[ 0 ] )
314 314
                 : ( string ) $asoCallable[ 0 ];
315 315
 
316
-            return '(callable) ' . $_sSubject . '::' . ( string ) $asoCallable[ 1 ];
316
+            return '(callable) '.$_sSubject.'::'.( string ) $asoCallable[ 1 ];
317 317
             
318 318
         }
319 319
         
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
          */
324 324
         static public function _getLegibleObject( $oObject ) {
325 325
             
326
-            if ( ! is_object( $oObject ) ) {
326
+            if ( !is_object( $oObject ) ) {
327 327
                 return $oObject;
328 328
             }
329 329
             
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
                 return ( string ) $oObject;
332 332
             }
333 333
             
334
-            return '(object) ' . get_class( $oObject ) . ' ' 
335
-                . count( get_object_vars( $oObject ) ) . ' properties.';
334
+            return '(object) '.get_class( $oObject ).' ' 
335
+                . count( get_object_vars( $oObject ) ).' properties.';
336 336
             
337 337
         }
338 338
         
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
          */
343 343
         static public function _getLegibleArray( $aArray ) {
344 344
             
345
-            if ( ! is_array( $aArray ) ) {
345
+            if ( !is_array( $aArray ) ) {
346 346
                 return $aArray;
347 347
             }
348 348
             return self::_getArrayMappedRecursive( 
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
      * @return      array
361 361
      * @internal
362 362
      */
363
-    static public function getSliceByDepth( array $aSubject, $iDepth=0 ) {
363
+    static public function getSliceByDepth( array $aSubject, $iDepth = 0 ) {
364 364
 
365 365
         foreach ( $aSubject as $_sKey => $_vValue ) {
366 366
             if ( is_array( $_vValue ) ) {
@@ -384,13 +384,13 @@  discard block
 block discarded – undo
384 384
         static private function _getLegibleValue( $mItem ) {
385 385
             
386 386
             if ( is_object( $mItem ) ) {
387
-                return '(object) ' . get_class( $mItem );
387
+                return '(object) '.get_class( $mItem );
388 388
             }
389 389
             if ( is_null( $mItem ) ) {
390 390
                 return '(null)';
391 391
             }
392 392
             if ( is_bool( $mItem ) ) {
393
-                return '(boolean) ' . ( $mItem ? 'true' : 'false' );
393
+                return '(boolean) '.( $mItem ? 'true' : 'false' );
394 394
             }
395 395
             // At this point, the value is a scalar.
396 396
             return self::_getLegibleString( $mItem );
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
              * @return      string
401 401
              * @since       3.8.9
402 402
              */
403
-            static private function _getLegibleString( $sScalar, $iCharLimit=300 ) {
403
+            static private function _getLegibleString( $sScalar, $iCharLimit = 300 ) {
404 404
                 
405 405
                 static $_iMBSupport;
406 406
                 $_iMBSupport = isset( $_iMBSupport ) ? $_iMBSupport : function_exists( 'mb_strlen' );      
@@ -409,9 +409,9 @@  discard block
 block discarded – undo
409 409
                 
410 410
                 $_iCharLength = call_user_func_array( $_aStrLenMethod[ $_iMBSupport ], array( $sScalar ) );
411 411
                 if ( $_iCharLength <= $iCharLimit ) {
412
-                    return '(' . gettype( $sScalar ) . ') ' . $sScalar;
412
+                    return '('.gettype( $sScalar ).') '.$sScalar;
413 413
                 }
414
-                return '(' . gettype( $sScalar ) . ') '
414
+                return '('.gettype( $sScalar ).') '
415 415
                     . call_user_func_array( $_aSubstrMethod[ $_iMBSupport ], array( $sScalar, 0, $iCharLimit ) ) 
416 416
                     . '...';
417 417
                     
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -435,7 +435,7 @@
 block discarded – undo
435 435
              * @return      mixed       A modified value.
436 436
              * @since       3.8.9
437 437
              */
438
-            static private function _getArrayMappedNested( $mItem ) {            
438
+            static private function _getArrayMappedNested( $mItem ) {
439 439
                 return is_array( $mItem ) 
440 440
                     ? array_map( array( __CLASS__, '_getArrayMappedNested' ), $mItem ) 
441 441
                     : call_user_func( self::$oCurrentCallable, $mItem );            
Please login to merge, or discard this patch.
admin-page-framework-loader.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
  */
17 17
 class AdminPageFrameworkLoader_Registry_Base {
18 18
 
19
-    const VERSION        = '3.8.9b01';    // <--- DON'T FORGET TO CHANGE THIS AS WELL!!
19
+    const VERSION        = '3.8.9b01'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!!
20 20
     const NAME           = 'Admin Page Framework - Loader'; // the name is not 'Admin Page Framework' because warning messages gets confusing.
21
-    const SHORTNAME      = 'Admin Page Framework';  // used for a menu title etc.
21
+    const SHORTNAME      = 'Admin Page Framework'; // used for a menu title etc.
22 22
     const DESCRIPTION    = 'Loads Admin Page Framework which facilitates WordPress plugin and theme development.';
23 23
     const URI            = 'http://admin-page-framework.michaeluno.jp/';
24 24
     const AUTHOR         = 'miunosoft (Michael Uno)';
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
      * @remark      This is also accessed from `uninstall.php` so do not remove.
56 56
      * @remark      Do not exceed 8 characters as a transient name allows 45 characters or less ( 40 for site transients ) so that md5 (32 characters) can be added.
57 57
      */
58
-    const TRANSIENT_PREFIX         = 'APFL_';
58
+    const TRANSIENT_PREFIX = 'APFL_';
59 59
 
60 60
     /**
61 61
      * The hook slug used for the prefix of action and filter hook names.
62 62
      * 
63 63
      * @remark      The ending underscore is not necessary.
64 64
      */
65
-    const HOOK_SLUG                = 'admin_page_framework_loader';
65
+    const HOOK_SLUG = 'admin_page_framework_loader';
66 66
 
67 67
     /**
68 68
      * The text domain slug and its path.
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      */
117 117
     static public $aAdminPages = array(
118 118
         // key => 'page slug'
119
-        'about'     => 'apfl_about',        // the welcome page
119
+        'about'     => 'apfl_about', // the welcome page
120 120
         'addon'     => 'apfl_addons',
121 121
         'tool'      => 'apfl_tools',
122 122
         'help'      => 'apfl_contact',
@@ -154,12 +154,12 @@  discard block
 block discarded – undo
154 154
      * @since       3.5.0
155 155
      * @return      string
156 156
      */
157
-    public static function getPluginURL( $sRelativePath='' ) {
157
+    public static function getPluginURL( $sRelativePath = '' ) {
158 158
         if ( isset( self::$_sPluginURLCache ) ) {
159
-            return self::$_sPluginURLCache . $sRelativePath;
159
+            return self::$_sPluginURLCache.$sRelativePath;
160 160
         }
161 161
         self::$_sPluginURLCache = trailingslashit( plugins_url( '', self::$sFilePath ) );
162
-        return self::$_sPluginURLCache . $sRelativePath;
162
+        return self::$_sPluginURLCache.$sRelativePath;
163 163
     }
164 164
         /**
165 165
          * @since       3.7.9
@@ -189,13 +189,13 @@  discard block
 block discarded – undo
189 189
      * @since       3.5.0
190 190
      * @return      void
191 191
      */ 
192
-    static public function setAdminNotice( $sMessage, $sClassAttribute='error' ) {
193
-        if ( ! is_admin() ) {  
192
+    static public function setAdminNotice( $sMessage, $sClassAttribute = 'error' ) {
193
+        if ( !is_admin() ) {  
194 194
             return; 
195 195
         }
196
-        self::$_aAdminNotices[] = array(
196
+        self::$_aAdminNotices[ ] = array(
197 197
             'message'           => $sMessage,
198
-            'class_attribute'   => trim( $sClassAttribute ) . ' notice is-dismissible',
198
+            'class_attribute'   => trim( $sClassAttribute ).' notice is-dismissible',
199 199
         );
200 200
         add_action( 'admin_notices', array( __CLASS__, '_replyToSetAdminNotice' ) );
201 201
     }
@@ -205,12 +205,12 @@  discard block
 block discarded – undo
205 205
          * @return      void
206 206
          */
207 207
         static public function _replyToSetAdminNotice() {
208
-            foreach( self::$_aAdminNotices as $_aAdminNotice ) {
209
-                echo "<div class='" . esc_attr( $_aAdminNotice['class_attribute'] ) . " notice is-dismissible'>"
208
+            foreach ( self::$_aAdminNotices as $_aAdminNotice ) {
209
+                echo "<div class='".esc_attr( $_aAdminNotice[ 'class_attribute' ] )." notice is-dismissible'>"
210 210
                         ."<p>"
211 211
                             . sprintf(
212
-                                '<strong>%1$s</strong>: ' . $_aAdminNotice['message'],
213
-                                self::NAME . ' ' . self::VERSION
212
+                                '<strong>%1$s</strong>: '.$_aAdminNotice[ 'message' ],
213
+                                self::NAME.' '.self::VERSION
214 214
                             )
215 215
                         . "</p>"
216 216
                     . "</div>";
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 AdminPageFrameworkLoader_Registry::setUp( __FILE__ );
223 223
 
224 224
 // Initial checks. - Do no load if accessed directly, not exiting because the 'uninstall.php' and inclusion list generator will load this file.
225
-if ( ! defined( 'ABSPATH' ) ) {
225
+if ( !defined( 'ABSPATH' ) ) {
226 226
     return;
227 227
 }
228 228
 if ( defined( 'DOING_UNINSTALL' ) ) {
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
 
235 235
     $_bFrameworkLoaded = class_exists( 'AdminPageFramework_Registry', false );
236 236
     if (
237
-        ! $_bFrameworkLoaded
238
-        || ! defined( 'AdminPageFramework_Registry::VERSION' ) // backward compatibility
237
+        !$_bFrameworkLoaded
238
+        || !defined( 'AdminPageFramework_Registry::VERSION' ) // backward compatibility
239 239
         || version_compare( AdminPageFramework_Registry::VERSION, AdminPageFrameworkLoader_Registry::VERSION, '<' )
240 240
     ) {
241 241
         AdminPageFrameworkLoader_Registry::setAdminNotice(
@@ -253,18 +253,18 @@  discard block
 block discarded – undo
253 253
 add_action( 'admin_init', 'AdminPageFrameworkLoader_Warning' );
254 254
 
255 255
 // Include the library file - the development version will be available if you cloned the GitHub repository.
256
-$_sDevelopmentVersionPath = AdminPageFrameworkLoader_Registry::$sDirPath . '/development/admin-page-framework.php';
256
+$_sDevelopmentVersionPath = AdminPageFrameworkLoader_Registry::$sDirPath.'/development/admin-page-framework.php';
257 257
 $_bDebugMode              = defined( 'WP_DEBUG' ) && WP_DEBUG;
258 258
 $_bLoadDevelopmentVersion = $_bDebugMode && file_exists( $_sDevelopmentVersionPath );
259 259
 include(
260 260
     $_bLoadDevelopmentVersion
261 261
         ? $_sDevelopmentVersionPath
262
-        : AdminPageFrameworkLoader_Registry::$sDirPath . '/library/apf/admin-page-framework.php'
262
+        : AdminPageFrameworkLoader_Registry::$sDirPath.'/library/apf/admin-page-framework.php'
263 263
 );
264 264
 
265 265
 // Include the framework loader plugin components.
266 266
 include( AdminPageFramework_Registry::$aClassFiles[ 'AdminPageFramework_PluginBootstrap' ] );
267
-include( AdminPageFrameworkLoader_Registry::$sDirPath . '/include/class/AdminPageFrameworkLoader_Bootstrap.php' );
267
+include( AdminPageFrameworkLoader_Registry::$sDirPath.'/include/class/AdminPageFrameworkLoader_Bootstrap.php' );
268 268
 new AdminPageFrameworkLoader_Bootstrap(
269 269
     AdminPageFrameworkLoader_Registry::$sFilePath,
270 270
     AdminPageFrameworkLoader_Registry::HOOK_SLUG    // hook prefix
Please login to merge, or discard this patch.