Removed remaining profile calls
[lhc/web/wiklou.git] / includes / parser / Preprocessor_Hash.php
index d7f5953..af91ad4 100644 (file)
  *   * attribute nodes are children
  *   * "<h>" nodes that aren't at the top are replaced with <possible-h>
  * @ingroup Parser
+ * @codingStandardsIgnoreStart
  */
 class Preprocessor_Hash implements Preprocessor {
+       // @codingStandardsIgnoreEnd
 
        /**
         * @var Parser
@@ -110,7 +112,6 @@ class Preprocessor_Hash implements Preprocessor {
         * @return PPNode_Hash_Tree
         */
        public function preprocessToObj( $text, $flags = 0 ) {
-               wfProfileIn( __METHOD__ );
 
                // Check cache.
                global $wgMemc, $wgPreprocessorCacheThreshold;
@@ -119,7 +120,6 @@ class Preprocessor_Hash implements Preprocessor {
                        && strlen( $text ) > $wgPreprocessorCacheThreshold;
 
                if ( $cacheable ) {
-                       wfProfileIn( __METHOD__ . '-cacheable' );
 
                        $cacheKey = wfMemcKey( 'preprocess-hash', md5( $text ), $flags );
                        $cacheValue = $wgMemc->get( $cacheKey );
@@ -130,12 +130,9 @@ class Preprocessor_Hash implements Preprocessor {
                                        // From the cache
                                        wfDebugLog( "Preprocessor",
                                                "Loaded preprocessor hash from memcached (key $cacheKey)" );
-                                       wfProfileOut( __METHOD__ . '-cacheable' );
-                                       wfProfileOut( __METHOD__ );
                                        return $hash;
                                }
                        }
-                       wfProfileIn( __METHOD__ . '-cache-miss' );
                }
 
                $rules = array(
@@ -635,18 +632,12 @@ class Preprocessor_Hash implements Preprocessor {
                                                        }
                                                        if ( !$node ) {
                                                                if ( $cacheable ) {
-                                                                       wfProfileOut( __METHOD__ . '-cache-miss' );
-                                                                       wfProfileOut( __METHOD__ . '-cacheable' );
                                                                }
-                                                               wfProfileOut( __METHOD__ );
                                                                throw new MWException( __METHOD__ . ': eqpos not found' );
                                                        }
                                                        if ( $node->name !== 'equals' ) {
                                                                if ( $cacheable ) {
-                                                                       wfProfileOut( __METHOD__ . '-cache-miss' );
-                                                                       wfProfileOut( __METHOD__ . '-cacheable' );
                                                                }
-                                                               wfProfileOut( __METHOD__ );
                                                                throw new MWException( __METHOD__ . ': eqpos is not equals' );
                                                        }
                                                        $equalsNode = $node;
@@ -746,12 +737,9 @@ class Preprocessor_Hash implements Preprocessor {
                if ( $cacheable ) {
                        $cacheValue = sprintf( "%08d", self::CACHE_VERSION ) . serialize( $rootNode );
                        $wgMemc->set( $cacheKey, $cacheValue, 86400 );
-                       wfProfileOut( __METHOD__ . '-cache-miss' );
-                       wfProfileOut( __METHOD__ . '-cacheable' );
                        wfDebugLog( "Preprocessor", "Saved preprocessor Hash to memcached (key $cacheKey)" );
                }
 
-               wfProfileOut( __METHOD__ );
                return $rootNode;
        }
 }
@@ -759,8 +747,11 @@ class Preprocessor_Hash implements Preprocessor {
 /**
  * Stack class to help Preprocessor::preprocessToObj()
  * @ingroup Parser
+ * @codingStandardsIgnoreStart
  */
 class PPDStack_Hash extends PPDStack {
+       // @codingStandardsIgnoreEnd
+
        public function __construct() {
                $this->elementClass = 'PPDStackElement_Hash';
                parent::__construct();
@@ -770,8 +761,11 @@ class PPDStack_Hash extends PPDStack {
 
 /**
  * @ingroup Parser
+ * @codingStandardsIgnoreStart
  */
 class PPDStackElement_Hash extends PPDStackElement {
+       // @codingStandardsIgnoreENd
+
        public function __construct( $data = array() ) {
                $this->partClass = 'PPDPart_Hash';
                parent::__construct( $data );
@@ -808,8 +802,11 @@ class PPDStackElement_Hash extends PPDStackElement {
 
 /**
  * @ingroup Parser
+ * @codingStandardsIgnoreStart
  */
 class PPDPart_Hash extends PPDPart {
+       // @codingStandardsIgnoreEnd
+
        public function __construct( $out = '' ) {
                $accum = new PPDAccum_Hash;
                if ( $out !== '' ) {
@@ -821,8 +818,11 @@ class PPDPart_Hash extends PPDPart {
 
 /**
  * @ingroup Parser
+ * @codingStandardsIgnoreStart
  */
 class PPDAccum_Hash {
+       // @codingStandardsIgnoreEnd
+
        public $firstNode, $lastNode;
 
        public function __construct() {
@@ -889,8 +889,10 @@ class PPDAccum_Hash {
 /**
  * An expansion frame, used as a context to expand the result of preprocessToObj()
  * @ingroup Parser
+ * @codingStandardsIgnoreStart
  */
 class PPFrame_Hash implements PPFrame {
+       // @codingStandardsIgnoreEnd
 
        /**
         * @var Parser
@@ -969,11 +971,17 @@ class PPFrame_Hash implements PPFrame {
                                if ( $bits['index'] !== '' ) {
                                        // Numbered parameter
                                        $index = $bits['index'] - $indexOffset;
+                                       if ( isset( $namedArgs[$index] ) || isset( $numberedArgs[$index] ) ) {
+                                               $this->parser->addTrackingCategory( 'duplicate-args-category' );
+                                       }
                                        $numberedArgs[$index] = $bits['value'];
                                        unset( $namedArgs[$index] );
                                } else {
                                        // Named parameter
                                        $name = trim( $this->expand( $bits['name'], PPFrame::STRIP_COMMENTS ) );
+                                       if ( isset( $namedArgs[$name] ) || isset( $numberedArgs[$name] ) ) {
+                                               $this->parser->addTrackingCategory( 'duplicate-args-category' );
+                                       }
                                        $namedArgs[$name] = $bits['value'];
                                        unset( $numberedArgs[$name] );
                                }
@@ -985,7 +993,7 @@ class PPFrame_Hash implements PPFrame {
        /**
         * @throws MWException
         * @param string|int $key
-        * @param string|PPNode_Hash|DOMDocument $root
+        * @param string|PPNode $root
         * @param int $flags
         * @return string
         */
@@ -1208,6 +1216,7 @@ class PPFrame_Hash implements PPFrame {
        /**
         * @param string $sep
         * @param int $flags
+        * @param string|PPNode $args,...
         * @return string
         */
        public function implodeWithFlags( $sep, $flags /*, ... */ ) {
@@ -1238,6 +1247,7 @@ class PPFrame_Hash implements PPFrame {
         * Implode with no flags specified
         * This previously called implodeWithFlags but has now been inlined to reduce stack depth
         * @param string $sep
+        * @param string|PPNode $args,...
         * @return string
         */
        public function implode( $sep /*, ... */ ) {
@@ -1269,6 +1279,7 @@ class PPFrame_Hash implements PPFrame {
         * with implode()
         *
         * @param string $sep
+        * @param string|PPNode $args,...
         * @return PPNode_Hash_Array
         */
        public function virtualImplode( $sep /*, ... */ ) {
@@ -1301,6 +1312,7 @@ class PPFrame_Hash implements PPFrame {
         * @param string $start
         * @param string $sep
         * @param string $end
+        * @param string|PPNode $args,...
         * @return PPNode_Hash_Array
         */
        public function virtualBracketedImplode( $start, $sep, $end /*, ... */ ) {
@@ -1453,8 +1465,11 @@ class PPFrame_Hash implements PPFrame {
 /**
  * Expansion frame with template arguments
  * @ingroup Parser
+ * @codingStandardsIgnoreStart
  */
 class PPTemplateFrame_Hash extends PPFrame_Hash {
+       // @codingStandardsIgnoreEnd
+
        public $numberedArgs, $namedArgs, $parent;
        public $numberedExpansionCache, $namedExpansionCache;
 
@@ -1505,7 +1520,7 @@ class PPTemplateFrame_Hash extends PPFrame_Hash {
        /**
         * @throws MWException
         * @param string|int $key
-        * @param string|PPNode_Hash|DOMDocument $root
+        * @param string|PPNode $root
         * @param int $flags
         * @return string
         */
@@ -1633,8 +1648,11 @@ class PPTemplateFrame_Hash extends PPFrame_Hash {
 /**
  * Expansion frame with custom arguments
  * @ingroup Parser
+ * @codingStandardsIgnoreStart
  */
 class PPCustomFrame_Hash extends PPFrame_Hash {
+       // @codingStandardsIgnoreEnd
+
        public $args;
 
        public function __construct( $preprocessor, $args ) {
@@ -1683,8 +1701,11 @@ class PPCustomFrame_Hash extends PPFrame_Hash {
 
 /**
  * @ingroup Parser
+ * @codingStandardsIgnoreStart
  */
 class PPNode_Hash_Tree implements PPNode {
+       // @codingStandardsIgnoreEnd
+
        public $name, $firstChild, $lastChild, $nextSibling;
 
        public function __construct( $name ) {
@@ -1905,8 +1926,11 @@ class PPNode_Hash_Tree implements PPNode {
 
 /**
  * @ingroup Parser
+ * @codingStandardsIgnoreStart
  */
 class PPNode_Hash_Text implements PPNode {
+       // @codingStandardsIgnoreEnd
+
        public $value, $nextSibling;
 
        public function __construct( $value ) {
@@ -1963,8 +1987,11 @@ class PPNode_Hash_Text implements PPNode {
 
 /**
  * @ingroup Parser
+ * @codingStandardsIgnoreStart
  */
 class PPNode_Hash_Array implements PPNode {
+       // @codingStandardsIgnoreEnd
+
        public $value, $nextSibling;
 
        public function __construct( $value ) {
@@ -2018,8 +2045,11 @@ class PPNode_Hash_Array implements PPNode {
 
 /**
  * @ingroup Parser
+ * @codingStandardsIgnoreStart
  */
 class PPNode_Hash_Attr implements PPNode {
+       // @codingStandardsIgnoreEnd
+
        public $name, $value, $nextSibling;
 
        public function __construct( $name, $value ) {