HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/delta/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Relation.php
<?php

namespace WPML\FP;

use WPML\Collect\Support\Traits\Macroable;

/**
 * @method static callable|bool equals( ...$a, ...$b ) - Curried :: a->b->bool
 * @method static callable|bool lt( ...$a, ...$b ) - Curried :: a->b->bool
 * @method static callable|bool lte( ...$a, ...$b ) - Curried :: a->b->bool
 * @method static callable|bool gt( ...$a, ...$b ) - Curried :: a->b->bool
 * @method static callable|bool gte( ...$a, ...$b ) - Curried :: a->b->bool
 * @method static callable|bool propEq( ...$prop, ...$value, ...$obj ) - Curried :: String → a → array → bool
 * @method static callable|array sortWith( ...$comparators, ...$array ) - Curried :: [(a, a) → int] → [a] → [a]
 */
class Relation {

	use Macroable;

	/**
	 * @return void
	 */
	public static function init() {

		self::macro( 'equals', curryN( 2, function ( $a, $b ) {
			return $a === $b;
		} ) );

		self::macro( 'lt', curryN( 2, function ( $a, $b ) {
			if ( is_string( $a ) && is_string( $b ) ) {
				return strcmp( $a, $b ) < 0;
			}

			return $a < $b;
		} ) );

		self::macro( 'gt', curryN( 2, function ( $a, $b ) {
			return self::lt( $b, $a );
		} ) );

		self::macro( 'lte', curryN( 2, function ( $a, $b ) {
			return ! self::gt( $a, $b );
		} ) );

		self::macro( 'gte', curryN( 2, function ( $a, $b ) {
			return ! self::lt( $a, $b );
		} ) );

		self::macro( 'propEq', curryN( 3, function ( $prop, $value, $obj ) {
			return Obj::prop( $prop, $obj ) === $value;
		} ) );

		self::macro( 'sortWith', curryN( 2, function ( $comparators, $array ) {
			$compareFn = function( $a, $b ) use ( $comparators ) {
				foreach ( $comparators as $comparator ) {
					$v = $comparator( $a, $b );
					if ( $v !== 0 ) {
						return $v;
					}
				}
				return 0;
			};
			return Lst::sort( $compareFn, $array );
		}));

	}
}

Relation::init();