Code Duplication    Length = 13-13 lines in 2 locations

ClashAPI/Location.class.php 2 locations

@@ 59-71 (lines=13) @@
56
	 * @param string, location name
57
	 * @return bool, success or fail
58
	 */
59
	public function setLocationByName($name)
60
	{
61
		foreach ($this->api->getLocationList()->items as $location) 
62
		{
63
			if ($location->name == $name) 
64
			{
65
				$this->locationId = $location->id;
66
				$this->location = $location;
67
				return 1;
68
			}
69
		}
70
		return 0;
71
	}
72
73
	/**
74
	 * Sets the location by providing it's country code
@@ 79-91 (lines=13) @@
76
     * @param string
77
     * @return bool
78
     */
79
	public function setLocationByCode($cc)
80
	{
81
		foreach ($this->api->getLocationList()->items as $location) 
82
		{
83
			if ($location->countryCode == $cc) 
84
			{
85
				$this->locationId = $location->id;
86
				$this->location = $location;
87
				return 1;
88
			}
89
		}
90
		return 0;
91
	}
92
93
	/**
94
	 * Gets the location ID