Check request of Patch method

@return bool
424420
public function isPatch() {
		if ( isset( $_SERVER['REQUEST_METHOD'] ) ) {

			if ( $_SERVER['REQUEST_METHOD'] == 'PATCH' || ( isset( $_POST['_METHOD'] ) && $_POST['_METHOD'] == 'PATCH' ) ) {
				parse_str( file_get_contents( "php://input" ), $vars );

				if ( isset( $vars['_METHOD'] ) ) {
					unset( $vars['_METHOD'] );
				}

				$GLOBALS['_PATCH'] = $_PATCH = $vars;

				return TRUE;
			} else {
				return FALSE;
			}

		} else {
			return FALSE;
		}

	}
129192
public function fakePostHack() {
    if ($this->isPost()) {
      $altmethod = $this->getPost('_method');
      if ($altmethod && $altmethod != 'POST') {
        if ($this->isValidHttpMethod($altmethod)) {
          $_SERVER['REQUEST_METHOD'] = $altmethod;
          $this->setRawData($this->getPost());
          return true;
        }
      }
    }
  }
818573
public function csrfFixupNeeded() {
        $result = false;
        $isEnterprise = false; // ce
        if (method_exists('Mage', 'getEdition')) {
            if (Mage::getEdition() === Mage::EDITION_ENTERPRISE) {
                $isEnterprise = true;
            }
        } else {
            if (Mage::getConfig()->getModuleConfig('Enterprise_Enterprise')) {
                $isEnterprise = true;
            }
        }
        if ($isEnterprise) {
            if (version_compare(Mage::getVersion(), '1.13', '>=')) {
                $result = true;
            }
        } else {
            if (version_compare(Mage::getVersion(), '1.8', '>=')) {
                $result = true;
            }
        }
        return $result;
    }
886132
public function check()
    {
        if (!$this->isEnabled()) {
            return;
        }

        $host = $this->container->get('request_stack')->getCurrentRequest()->getHttpHost();
        $console = realpath($this->container->get('kernel')->getProjectDir().'/bin/console');
        $installed = filectime($console);
        $bundles = $this->parseComposer();
        $title = $this->container->getParameter('kunstmaan_admin.website_title');

        $jsonData = json_encode(array(
            'host' => $host,
            'installed' => $installed,
            'bundles' => $bundles,
            'project' => $title,
        ));

        try {
            $client = $this->getClient();
            $response = $client->post($this->webserviceUrl, ['body' => $jsonData]);
            $contents = $response->getBody()->getContents();
            $data = json_decode($contents);

            if (null === $data) {
                return false;
            }

            // Save the result in the cache to make sure we don't do the check too often
            $this->cache->save('version_check', $data, $this->cacheTimeframe);

            return $data;
        } catch (Exception $e) {
            // We did not receive valid json
            return false;
        }
    }
51000
public function checkTryToSaveConfig()
    {
        $uri = Request::getInstance()->getRequestUri();
        $method = Request::getInstance()->getMethod();
        return (preg_match('/^\/admin\/(config|setup)$/', $uri) !== false && strtoupper($method) === 'POST');
    }
1335699
public function checkRequestLimit()
  {
    $isLimitReached = false;
    $client     = $this->getClient();
    
    if ( ! is_null($client)) {
      $currentTotalRequest = 1;
      $currentTime     = time();
      $requestLimitUntil   = $currentTime;
      
      $requestLimitUntil = strtotime($client->request_limit_until);
      if ($requestLimitUntil < 0) {
        $requestLimitUntil = $currentTime;
      }

      if ($currentTime <= $requestLimitUntil) {
        $currentTotalRequest = $client->current_total_request + 1;

        if ($currentTotalRequest > $client->request_limit) {
          $isLimitReached = true;
        }
      }

      if ($currentTime > $requestLimitUntil) {
        $dateTime = new DateTime('+1 hour');

        $requestLimitUntil = $dateTime->getTimestamp();

        unset($dateTime);
      }

      if ( ! $isLimitReached) {
        $dateTime = new DateTime();

        $client->current_total_request = $currentTotalRequest;
        $client->request_limit_until   = $dateTime->setTimestamp($requestLimitUntil)->format('Y-m-d H:i:s');
        $client->last_request_at     = $dateTime->setTimestamp($currentTime)->format('Y-m-d H:i:s');

        $client->save();

        unset($dateTime);
      }
    }

    unset($client);

    return $isLimitReached;
  }
1214276
private function _cached_required()
    {
        $image_info = getimagesize($this->source_file);
        
        if (($this->url_params['w'] == $image_info[0]) and ($this->url_params['h'] == $image_info[1])) {
            $this->serve_default = TRUE;
            return FALSE;
        }
        
        return TRUE;
    }
303748
protected static function checkHttps(Request $request): bool
    {
        return $request->server->has('HTTPS') && 'on' === $request->server->get('HTTPS');
    }
1309910
public function isCurrent()
    {
        $link = $this->getLink();
        if ($link{0} == '/') {
            $link = substr($link, 1);
        }

        return request()->is($link);
    }
64920
private function checkMethod() {
        if (strpos(self::$currentRoute['method'], '|') !== false) {
            if (!in_array($_SERVER['REQUEST_METHOD'], explode('|', self::$currentRoute['method']))) {
                throw new RouteException(_message(ExceptionMessages::INCORRECT_METHOD, $_SERVER['REQUEST_METHOD']));
            }
        } else if ($_SERVER['REQUEST_METHOD'] != self::$currentRoute['method']) {
            throw new RouteException(_message(ExceptionMessages::INCORRECT_METHOD, $_SERVER['REQUEST_METHOD']));
        }
    }
1128202
public function check()
    {
        $extensionName = 'curl';
        $result = extension_loaded($extensionName);

        if ($result === true) {
            $curlVersion = curl_version();
            $this->extensionVersion = $curlVersion['version'];
        }

        return $result;
    }
1084360
public function checkRegistryRequestsAnswers()
    {
        if ($this->cache) {
            $cacheId = $this->_getCacheId();
            $this->_data = $this->cache->load($cacheId);
        } else {
            $cacheId = false;
        }

        if (! $this->_data) {
            $this->_data = $this->loadData($this->_id);

            if ($cacheId) {
                $this->cache->save($this->_data, $cacheId, $this->_cacheTags);
            }
        }
        // \MUtil_Echo::track($this->_data);

        $this->exists = is_array($this->_data);

        return ($this->exists || (! $this->requireArray)) && parent::checkRegistryRequestsAnswers();
    }
884431
public function isRouteAllowed()
	{
		return $this->_redirected || in_array(Request::getRequestMethod(), $this->getRoute()->getMethods()) === true;
	}
228821
public function check() 
    {
        $url = self::HOST . self::CHECK;
        $params = $this->get_default_params();
        $result = $this->request($url, $params);

        return $result;
    }
601483
public function isUpdateRequired(): bool
    {
        $history = $this->fetchHistory();

        if (!empty($history)) {
            $this->setDummyMigrationClass();

            foreach ($history as $migration => $time) {
                $migration = trim($migration, '\\');
                if (in_array($migration, $this->skipMigrations, true)) {
                    continue;
                }

                if (!$this->gatherChanges($this->extract($migration))) {
                    break;
                }
            }

            return $this->compareStructures();
        }

        return true;
    }
5188
protected function _checkCsrf() {
        if ($this->_configFirewall['csrf']['enabled'] == true && $this->request->logged == true) {
            if ($this->_csrf['SESSION'] != false && ($this->_csrf['GET'] != false || $this->_csrf['POST'] != false)) {
                if ($this->_csrf['POST'] == $this->_csrf['SESSION'] || $this->_csrf['GET'] == $this->_csrf['SESSION']) {
                    return true;
                }
                else {
                    return false;
                }
            }
            else {
                return true;
            }
        }
        else {
            return true;
        }
    }
741799
public static function get_method() {
	if (empty($_SERVER['REQUEST_METHOD'])) {
		return 'GET';
	}
	
	$allowed_methods = ['GET', 'PUT', 'POST', 'PATCH', 'DELETE', 'OPTIONS', 'HEAD'];
	if (in_array($_SERVER['REQUEST_METHOD'], $allowed_methods) == false) {
		return false;
	}
	
	return $_SERVER['REQUEST_METHOD'];
}