Code Duplication    Length = 10-14 lines in 2 locations

uri.lib.php 2 locations

@@ 573-582 (lines=10) @@
570
		 * @param  string $str     The modfication
571
		 * @return string|false    Returns the resulting URI on success, FALSE otherwise
572
		 */
573
		public static function scheme_symbols(&$object, $action, $str) {
574
			$org = $object->scheme_symbols;
575
			\uri\actions::callback($object, $action, __FUNCTION__, $str);
576
			if (!(preg_match('/\A(:)?([\/]{2,3})?\Z/', $object->scheme_symbols) || empty($str))) {
577
				$object->scheme_symbols = $org;
578
				return FALSE;
579
			}
580
			
581
			return \uri\generate::string($object);
582
		}
583
		
584
		/**
585
		 * Modfies the Scheme
@@ 691-704 (lines=14) @@
688
		 * @param  string $str     The modfication
689
		 * @return string|false    Returns the resulting URI on success, FALSE otherwise
690
		 */
691
		public static function host(&$object, $action, $str) {
692
			$org = $object->host;
693
			\uri\actions::callback($object, $action, __FUNCTION__, $str);
694
			if ((
695
				!preg_match('/\A(([a-z0-9_]([a-z0-9\-_]+)?)\.)+[a-z0-9]([a-z0-9\-]+)?\Z/i', $object->host) // fqdn
696
				&&
697
				!preg_match('/\A([0-9]\.){3}[0-9]\Z/i', $object->host) // ip
698
			)) {
699
				$object->host = $org;
700
				return FALSE;
701
			}
702
			
703
			return \uri\generate::string($object);
704
		}
705
		
706
		/**
707
		 * Alias of host()