/** * @dataProvider randomStringProvider * * @param int $length * * @return void */ public function testGenerateRandomString($length) { $generator = new StringGenerator(); $generator->setLength($length); $string = $generator->generateRandomString(); $this->assertSame($length, strlen($string)); }
/** * @return string */ protected function getRandomString() { $generator = new StringGenerator(); return $generator->generateRandomString(); }
/** * @return string */ private function getRandomString() { $generator = new StringGenerator(); return 'test_' . $generator->generateRandomString(); }
/** * @param \SimpleXMLElement $fromXmlChildElement * @param string $tagName * * @return string */ private function getElementName(\SimpleXMLElement $fromXmlChildElement, $tagName) { $elementName = (array) $fromXmlChildElement->attributes(); $elementName = current($elementName); if (is_array($elementName) && array_key_exists('name', $elementName)) { $elementName = $tagName . '|' . $elementName['name']; } if (empty($elementName) || is_array($elementName)) { $generator = new StringGenerator(); $elementName = 'anonymous_' . $generator->generateRandomString(); } return $elementName; }
/** * @param string $prefix * * @return $this */ protected function generateTableIdentifier($prefix = 'table-') { $generator = new StringGenerator(); $this->tableIdentifier = $prefix . $generator->generateRandomString(); return $this; }
/** * @param string $type * @param string|null $fileName * * @return string */ public function render($type, $fileName = null) { $generator = new StringGenerator(); if ($fileName === null) { $fileName = sys_get_temp_dir() . '/' . $generator->generateRandomString(); } $this->graph->export($type, $fileName); return file_get_contents($fileName); }
/** * @return string */ public function generateKey() { $generator = new StringGenerator(); return $generator->generateRandomString(); }