To clean the data

@param mixed $data
@param bool  $secure

@return mixed
358480
public static function make($data, $secure = false)
    {
        // Recovery of the function at the lance.
        $method = $secure === true ? 'secure' : 'data';

        // Strict integer regex
        $rNum = '/^[0-9]+(\.[0-9]+)?$/';

        if (is_string($data)) {
            if (! preg_match($rNum, $data, $match)) {
                return static::$method($data);
            }

            if (count($match) == 2) {
                $data = (float) $data;
            } else {
                $data = (int) $data;
            }

            return $data;
        }

        if (is_numeric($data)) {
            return $data;
        }

        if (is_array($data)) {
            foreach ($data as $key => $value) {
                $data[$key] = static::make($value, $secure);
            }
            return $data;
        }

        if (is_object($data)) {
            foreach ($data as $key => $value) {
                $data->$key = static::make($value, $secure);
            }
            return $data;
        }

        return $data;
    }
1140663
private function decrypt(string $data)
  {
    $secret = explode(':', config('app.key'))[1];
    $secret = base64_decode($secret);

    return (new Encrypter($secret))->decrypt($data);
  }
428768
protected function getSchemeForUrl($secure)
  {
    if (is_null($secure)) {
      if (is_null($this->cachedScheme)) {
          $this->cachedScheme = $this->plugin->make('request')->getScheme().'://';
      }

      return $this->cachedScheme;
    }

    return $secure ? 'https://' : 'http://';
  }
1236522
final protected function sanitize($data)
    {
        // Recursively loop through the data array and return the sanitized data
        $sanitized = [];
        if (is_array($data)) {
            foreach ($data as $key => $value) {
                $sanitized[$key] = $this->sanitize($value);
            }
        } else {
            $sanitized = trim(strip_tags($data));
        }
        return $sanitized;
    }
696302
static function smartUnserialize(string $data)
    {
        try {
            $value = @unserialize($data);
        } catch (\Throwable $e) {
            throw new DeserializationFailedException('An exception was thrown during unserialization', 0, $e);
        }

        // distinguish between "false on error" and a serialized FALSE value
        if ($value === false && $data !== self::getSerializedFalse()) {
            throw new DeserializationFailedException('Unserialization failed - data possibly malformed');
        }

        return $value;
    }
1303941
protected static function JsHash($String, $Secure = TRUE)
    {
        if ($Secure === TRUE)
            $Secure = 'md5';

        switch ($Secure) {
            case 'sha1':
                return sha1($String);
                break;
            case 'md5':
            case FALSE:
                return md5($String);
            default:
                return hash($Secure, $String);
        }
    }
1210696
protected function unserialize(string $data)
    {
        $unserializedData = json_decode($data, true);
        $unserializedData['d'] = unserialize($unserializedData['d']);

        return $unserializedData;
    }
764502
protected static function _processFolders($secureFolders)
    {
        $secureFolders = array_filter(is_array($secureFolders) ? $secureFolders : explode(',', $secureFolders), 'trim');
        foreach ($secureFolders as $k => $folder) {
            $secureFolders[$k] = '/' . trim($folder, '/');
        }
        if (in_array('/', $secureFolders)) {
            return ['/']; // all uploads are secure
        }
        foreach ($secureFolders as $k => $folder) {
            foreach ($secureFolders as $folderCheck) {
                if (strpos($folder, $folderCheck . '/') === 0) {
                    unset($secureFolders[$k]);
                }
            }
        }
        return $secureFolders;
    }
429896
public function validateChecksum($data)
    {
        if (!isset($data['checksum']) || !$this->getEsiKey()) {
            return false;
        }

        $suppliedChecksum = $data['checksum'];
        unset($data['checksum']);
        return $suppliedChecksum === $this->getChecksum($data);
    }
928700
public function delete($data)
	{
		// Process data given.
		$processPayload = $this->process(__FUNCTION__, $data);

		if( ! $processPayload->isStatus(Payload::STATUS_VALID))
		{
			return $processPayload;
		}

		// Find Entity(s).
		$identifierPayload = $this->aggregate[IdentifierServiceProvider::getProviderKey()]->get(
			['filter' => ['uuid' => $processPayload->getData()['uuid']]]
		);

		if($identifierPayload->getStatus() != 'found')
		{
			return $identifierPayload;
		}

		// Perform delete.
		$deletePayload = $this->aggregate[self::getEntityType()]->delete($identifierPayload->getData()->pluck('entity_id')->toArray());

		if($deletePayload->getStatus() != 'deleted')
		{
			return new Payload($identifierPayload->getData(), $deletePayload->getStatus());
		}

		return new Payload($identifierPayload->getData(), $deletePayload->getStatus());
	}
122483
public static function xss_clean(array $data)
    {
        foreach ($data as $k => $v) {
            $data[$k] = filter_var($v, FILTER_SANITIZE_STRING);
        }

        return $data;
    }
51359
public function xssClean(array $data)
    {
        foreach ($data as $k => $v) {
            $data[$k] = filter_var($v, FILTER_SANITIZE_STRING);
        }

        return $data;
    }
1169272
public static function root($secure = null)
    {
        $framework = '/public/index.php';
        $server = request('PHP_SELF', '', 'server');
        $scheme = (is_null($secure) ? request('REQUEST_SCHEME', '', 'server') : ($secure ? 'https' : 'http')).'://';
        $serverName = request('SERVER_NAME', '', 'server');

        $parts = explode($framework, $server);

        $root = $parts[0].'/';

        return $scheme.$serverName.$root;
    }
1021684
public function _flush($data)
    {
        if ($this->_cancel) {
            return $data;
        }
        $contentType = null;
        $storedHeaders = array();
        $headersList = headers_list();
        foreach($this->_specificOptions['memorize_headers'] as $key=>$headerName) {
            foreach ($headersList as $headerSent) {
                $tmp = explode(':', $headerSent);
                $headerSentName = trim(array_shift($tmp));
                if (strtolower($headerName) == strtolower($headerSentName)) {
                    $headerSentValue = trim(implode(':', $tmp));
                    $storedHeaders[] = array($headerSentName, $headerSentValue);
                }
            }
        }
        $array = array(
            'data' => $data,
            'headers' => $storedHeaders
        );
        $this->save($array, null, $this->_activeOptions['tags'], $this->_activeOptions['specific_lifetime'], $this->_activeOptions['priority']);
        return $data;
    }
1161710
public static function clean($data) {
		// String?
		if (!is_array($data)) return $data;
		// Needs a good scrubbing...
		$out = [];
		$whitelist = ['.priority'];
		// Recursive iterator to sanitize all keys (and flatten object values)
		foreach ($data as $key => $value) {
			$key = (in_array($key, $whitelist) !== false) ? $key : preg_replace('/[\.\#\$\/\[\]]/i', '', $key);
			if (is_object($value)) $value = $value->__toString();
			if (is_array($value) || is_object($value)) {
				$out[$key] = self::clean($value);
			} else {
				$out[$key] = $value;
			}
		}
		return $out;
	}
1352008
public static function getRandomHash(bool $secure = false): string
    {
        return self::hash(microtime() . rand(10000, 100000), $secure);
    }
987048
protected function refreshData($data) {
        OpenpayConsole::trace('OpenpayApiResourceBase @refreshData');

        if (!$data) {
            return $this;
        }

        if (!is_array($data)) {
            throw new OpenpayApiError("Invalid data received for processing, cannot update the Openpay resource");
        }

        // unsets the unused attributes
        $removed = array_diff(array_keys($this->serializableData), array_keys($data));
        if (count($removed)) {
            OpenpayConsole::debug('OpenpayApiResourceBase @refreshData > removing unused data');
            foreach ($removed as $k) {
                if ($this->serializableData[$k]) {
                    unset($this->serializableData[$k]);
                }
                if ($this->noSerializableData[$k]) {
                    $this->noSerializableData[$k] = null;
                }
                if ($this->derivedResources[$k]) {
                    //$this->derivedResources[$k] = null;
                }
            }
        }

        foreach ($data as $k => $v) {
            $k = strtolower($k);

            $value = $this->processAttribute($k, $v);

            if ($k == 'id') {
                if (!isset($this->id)) {
                    $this->id = $v;
                }
                continue;

                // by default, only protected vars & serializable data will be refresh
                // in this version, noSerializableData does not store any value
            } else if (property_exists($this, $k)) {
                $this->$k = $value;
                //if ($this->noSerializableData[$k]) {
                //	$this->noSerializableData[$k] = $value;
                //}
            } else {
                $this->serializableData[$k] = $value;
            }
        }
        return $this;
    }