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

@@ 383-396 (lines=14) @@
380
	 *
381
	 * @return string
382
	 */
383
	public function token(int $length = 0): string {
384
		$chars = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890';
385
386
		$str = '';
387
		$max = strlen($chars) - 1;
388
		for ($i = 0; $i <= $length; $i++) {
389
			try {
390
				$str .= $chars[random_int(0, $max)];
391
			} catch (Exception $e) {
392
			}
393
		}
394
395
		return $str;
396
	}
397
398
399
	/**