Merge "Chinese Conversion Table Update 2017-6"
[lhc/web/wiklou.git] / includes / libs / stats / BufferingStatsdDataFactory.php
index f687254..06915b2 100644 (file)
@@ -32,7 +32,7 @@ use Liuggio\StatsdClient\Factory\StatsdDataFactory;
  *
  * @since 1.25
  */
-class BufferingStatsdDataFactory extends StatsdDataFactory implements MediawikiStatsdDataFactory {
+class BufferingStatsdDataFactory extends StatsdDataFactory implements IBufferingStatsdDataFactory {
        protected $buffer = [];
        /**
         * Collection enabled?
@@ -99,27 +99,22 @@ class BufferingStatsdDataFactory extends StatsdDataFactory implements MediawikiS
                return $this->buffer;
        }
 
-       /**
-        * Check whether this data factory has any data.
-        * @return boolean
-        */
        public function hasData() {
                return !empty( $this->buffer );
        }
 
-       /**
-        * Return data from the factory.
-        * @return StatsdData[]
-        */
        public function getData() {
                return $this->buffer;
        }
 
-       /**
-        * Set collection enable status.
-        * @param bool $enabled Will collection be enabled?
-        * @return void
-        */
+       public function clearData() {
+               $this->buffer = [];
+       }
+
+       public function getDataCount() {
+               return count( $this->buffer );
+       }
+
        public function setEnabled( $enabled ) {
                $this->enabled = $enabled;
        }