Code Duplication    Length = 14-14 lines in 2 locations

lib/ShareByCircleProvider.php 1 location

@@ 1004-1017 (lines=14) @@
1001
	 *
1002
	 * @return string
1003
	 */
1004
	protected function token(int $length = 15): string {
1005
		$chars = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890';
1006
1007
		$str = '';
1008
		$max = strlen($chars);
1009
		for ($i = 0; $i < $length; $i++) {
1010
			try {
1011
				$str .= $chars[random_int(0, $max - 1)];
1012
			} catch (Exception $e) {
1013
			}
1014
		}
1015
1016
		return $str;
1017
	}
1018
1019
1020
}

lib/Service/MiscService.php 1 location

@@ 376-389 (lines=14) @@
373
	 *
374
	 * @return string
375
	 */
376
	public function token(int $length = 0): string {
377
		$chars = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890';
378
379
		$str = '';
380
		$max = strlen($chars) - 1;
381
		for ($i = 0; $i <= $length; $i++) {
382
			try {
383
				$str .= $chars[random_int(0, $max)];
384
			} catch (Exception $e) {
385
			}
386
		}
387
388
		return $str;
389
	}
390
391
392
	/**