Code Duplication    Length = 13-13 lines in 2 locations

ClashAPI/Location.class.php 2 locations

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