diff --git a/.gitignore b/.gitignore index e1e8e8882..43bc74e0e 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,7 @@ data/conf/rspamd/local.d/* data/conf/rspamd/override.d/* data/conf/sogo/custom-theme.js data/conf/sogo/plist_ldap +data/conf/sogo/plist_ldap.sh data/conf/sogo/sieve.creds data/conf/sogo/sogo-full.svg data/gitea/ diff --git a/data/Dockerfiles/sogo/bootstrap-sogo.sh b/data/Dockerfiles/sogo/bootstrap-sogo.sh index 3eb591186..8913fd2c8 100755 --- a/data/Dockerfiles/sogo/bootstrap-sogo.sh +++ b/data/Dockerfiles/sogo/bootstrap-sogo.sh @@ -107,7 +107,7 @@ while read -r line gal " >> /var/lib/sogo/GNUstep/Defaults/sogod.plist # Generate alternative LDAP authentication dict, when SQL authentication fails # This will nevertheless read attributes from LDAP - line=${line} envsubst < /etc/sogo/plist_ldap >> /var/lib/sogo/GNUstep/Defaults/sogod.plist + /etc/sogo/plist_ldap.sh ${line} ${gal} >> /var/lib/sogo/GNUstep/Defaults/sogod.plist echo " " >> /var/lib/sogo/GNUstep/Defaults/sogod.plist done < <(mysql --socket=/var/run/mysqld/mysqld.sock -u ${DBUSER} -p${DBPASS} ${DBNAME} -e "SELECT domain, CASE gal WHEN '1' THEN 'YES' ELSE 'NO' END AS gal FROM domain;" -B -N) diff --git a/data/conf/phpfpm/crons/keycloak-sync.php b/data/conf/phpfpm/crons/keycloak-sync.php index da26ca5be..0525f9572 100644 --- a/data/conf/phpfpm/crons/keycloak-sync.php +++ b/data/conf/phpfpm/crons/keycloak-sync.php @@ -18,7 +18,7 @@ try { $pdo = new PDO($dsn, $database_user, $database_pass, $opt); } catch (PDOException $e) { - logMsg("danger", $e->getMessage()); + logMsg("err", $e->getMessage()); session_destroy(); exit; } @@ -68,11 +68,12 @@ $_SESSION['acl']['ratelimit'] = "1"; $_SESSION['acl']['sogo_access'] = "1"; $_SESSION['acl']['protocol_access'] = "1"; $_SESSION['acl']['mailbox_relayhost'] = "1"; +$_SESSION['acl']['unlimited_quota'] = "1"; // Init Keycloak Provider $iam_provider = identity_provider('init'); $iam_settings = identity_provider('get'); -if (intval($iam_settings['periodic_sync']) != 1 && $iam_settings['import_users'] != 1) { +if ($iam_settings['authsource'] != "keycloak" || (intval($iam_settings['periodic_sync']) != 1 && intval($iam_settings['import_users']) != 1)) { session_destroy(); exit; } @@ -127,18 +128,18 @@ while (true) { curl_close($ch); if ($code != 200){ - logMsg("danger", "Recieved HTTP {$code}"); + logMsg("err", "Recieved HTTP {$code}"); session_destroy(); exit; } try { $response = json_decode($response, true); } catch (Exception $e) { - logMsg("danger", $e->getMessage()); + logMsg("err", $e->getMessage()); break; } if (!is_array($response)){ - logMsg("danger", "Recieved malformed response from keycloak api"); + logMsg("err", "Recieved malformed response from keycloak api"); break; } if (count($response) == 0) { @@ -181,7 +182,7 @@ while (true) { } } if (!$mbox_template){ - logMsg("warning", "No matching mapper found for mailbox_template"); + logMsg("warning", "No matching attribute mapping found for user " . $user['email']); continue; } @@ -191,14 +192,16 @@ while (true) { mailbox('add', 'mailbox_from_template', array( 'domain' => explode('@', $user['email'])[1], 'local_part' => explode('@', $user['email'])[0], + 'name' => $user['firstName'] . " " . $user['lastName'], 'authsource' => 'keycloak', 'template' => $mbox_template )); - } else if ($row) { + } else if ($row && intval($iam_settings['periodic_sync']) == 1) { // mailbox user does exist, sync attribtues... logMsg("info", "Syncing attributes for user " . $user['email']); mailbox('edit', 'mailbox_from_template', array( 'username' => $user['email'], + 'name' => $user['firstName'] . " " . $user['lastName'], 'template' => $mbox_template )); } else { diff --git a/data/conf/phpfpm/crons/ldap-sync.php b/data/conf/phpfpm/crons/ldap-sync.php new file mode 100644 index 000000000..5686bdacc --- /dev/null +++ b/data/conf/phpfpm/crons/ldap-sync.php @@ -0,0 +1,176 @@ + PDO::ERRMODE_EXCEPTION, + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, + PDO::ATTR_EMULATE_PREPARES => false, +]; +try { + $pdo = new PDO($dsn, $database_user, $database_pass, $opt); +} +catch (PDOException $e) { + logMsg("err", $e->getMessage()); + session_destroy(); + exit; +} + +// Init Redis +$redis = new Redis(); +try { + if (!empty(getenv('REDIS_SLAVEOF_IP'))) { + $redis->connect(getenv('REDIS_SLAVEOF_IP'), getenv('REDIS_SLAVEOF_PORT')); + } + else { + $redis->connect('redis-mailcow', 6379); + } +} +catch (Exception $e) { + echo "Exiting: " . $e->getMessage(); + session_destroy(); + exit; +} + +function logMsg($priority, $message, $task = "LDAP Sync") { + global $redis; + + $finalMsg = array( + "time" => time(), + "priority" => $priority, + "task" => $task, + "message" => $message + ); + $redis->lPush('CRON_LOG', json_encode($finalMsg)); +} + +// Load core functions first +require_once __DIR__ . '/../web/inc/functions.inc.php'; +require_once __DIR__ . '/../web/inc/functions.auth.inc.php'; +require_once __DIR__ . '/../web/inc/sessions.inc.php'; +require_once __DIR__ . '/../web/inc/functions.mailbox.inc.php'; +require_once __DIR__ . '/../web/inc/functions.ratelimit.inc.php'; +require_once __DIR__ . '/../web/inc/functions.acl.inc.php'; + +$_SESSION['mailcow_cc_username'] = "admin"; +$_SESSION['mailcow_cc_role'] = "admin"; +$_SESSION['acl']['tls_policy'] = "1"; +$_SESSION['acl']['quarantine_notification'] = "1"; +$_SESSION['acl']['quarantine_category'] = "1"; +$_SESSION['acl']['ratelimit'] = "1"; +$_SESSION['acl']['sogo_access'] = "1"; +$_SESSION['acl']['protocol_access'] = "1"; +$_SESSION['acl']['mailbox_relayhost'] = "1"; +$_SESSION['acl']['unlimited_quota'] = "1"; + +// Init Provider +$iam_provider = identity_provider('init'); +$iam_settings = identity_provider('get'); +if ($iam_settings['authsource'] != "ldap" || (intval($iam_settings['periodic_sync']) != 1 && intval($iam_settings['import_users']) != 1)) { + session_destroy(); + exit; +} + +// Set pagination variables +$start = 0; +$max = 25; + +// lock sync if already running +$lock_file = '/tmp/iam-sync.lock'; +if (file_exists($lock_file)) { + $lock_file_parts = explode("\n", file_get_contents($lock_file)); + $pid = $lock_file_parts[0]; + if (count($lock_file_parts) > 1){ + $last_execution = $lock_file_parts[1]; + $elapsed_time = (time() - $last_execution) / 60; + if ($elapsed_time < intval($iam_settings['sync_interval'])) { + logMsg("warning", "Sync not ready (".number_format((float)$elapsed_time, 2, '.', '')."min / ".$iam_settings['sync_interval']."min)"); + session_destroy(); + exit; + } + } + + if (posix_kill($pid, 0)) { + logMsg("warning", "Sync is already running"); + session_destroy(); + exit; + } else { + unlink($lock_file); + } +} +$lock_file_handle = fopen($lock_file, 'w'); +fwrite($lock_file_handle, getmypid()); +fclose($lock_file_handle); + +// Get ldap users +$response = $iam_provider->query() + ->where($iam_settings['username_field'], "*") + ->where($iam_settings['attribute_field'], "*") + ->select([$iam_settings['username_field'], $iam_settings['attribute_field'], 'displayname']) + ->paginate($max); + +// Process the users +foreach ($response as $user) { + $mailcow_template = $user[$iam_settings['attribute_field']][0]; + + // try get mailbox user + $stmt = $pdo->prepare("SELECT `mailbox`.* FROM `mailbox` + INNER JOIN domain on mailbox.domain = domain.domain + WHERE `kind` NOT REGEXP 'location|thing|group' + AND `domain`.`active`='1' + AND `username` = :user"); + $stmt->execute(array(':user' => $user[$iam_settings['username_field']][0])); + $row = $stmt->fetch(PDO::FETCH_ASSOC); + + // check if matching attribute mapping exists + $mbox_template = null; + foreach ($iam_settings['mappers'] as $index => $mapper){ + if ($mapper == $mailcow_template) { + $mbox_template = $iam_settings['templates'][$index]; + break; + } + } + if (!$mbox_template){ + logMsg("warning", "No matching attribute mapping found for user " . $user[$iam_settings['username_field']][0]); + continue; + } + + if (!$row && intval($iam_settings['import_users']) == 1){ + // mailbox user does not exist, create... + logMsg("info", "Creating user " . $user[$iam_settings['username_field']][0]); + mailbox('add', 'mailbox_from_template', array( + 'domain' => explode('@', $user[$iam_settings['username_field']][0])[1], + 'local_part' => explode('@', $user[$iam_settings['username_field']][0])[0], + 'name' => $user['displayname'][0], + 'authsource' => 'ldap', + 'template' => $mbox_template + )); + } else if ($row && intval($iam_settings['periodic_sync']) == 1) { + // mailbox user does exist, sync attribtues... + logMsg("info", "Syncing attributes for user " . $user[$iam_settings['username_field']][0]); + mailbox('edit', 'mailbox_from_template', array( + 'username' => $user[$iam_settings['username_field']][0], + 'name' => $user['displayname'][0], + 'template' => $mbox_template + )); + } else { + // skip mailbox user + logMsg("info", "Skipping user " . $user[$iam_settings['username_field']][0]); + } + + sleep(0.025); +} + +logMsg("info", "DONE!"); +// add last execution time to lock file +$lock_file_handle = fopen($lock_file, 'w'); +fwrite($lock_file_handle, getmypid() . "\n" . time()); +fclose($lock_file_handle); +session_destroy(); diff --git a/data/conf/sogo/custom-sogo.js b/data/conf/sogo/custom-sogo.js index 9ee6daba1..44afa2998 100644 --- a/data/conf/sogo/custom-sogo.js +++ b/data/conf/sogo/custom-sogo.js @@ -1,3 +1,49 @@ +// redirect to mailcow login form +document.addEventListener('DOMContentLoaded', function () { + var loginForm = document.forms.namedItem("loginForm"); + if (loginForm) { + window.location.href = '/'; + } + + angularReady = false; + // Wait for the Angular components to be initialized + function waitForAngularComponents(callback) { + const targetNode = document.body; + + const observer = new MutationObserver(function(mutations) { + mutations.forEach(function(mutation) { + if (mutation.addedNodes.length > 0) { + const toolbarElement = document.body.querySelector('md-toolbar'); + if (toolbarElement) { + observer.disconnect(); + callback(); + } + } + }); + }); + + const config = { childList: true, subtree: true }; + observer.observe(targetNode, config); + } + + // Usage + waitForAngularComponents(function() { + if (!angularReady){ + angularReady = true; + + const toolbarElement = document.body.querySelector('.md-toolbar-tools.sg-toolbar-group-last.layout-align-end-center.layout-row'); + + var htmlCode = '' + + 'build' + + '' + + 'settings_power' + + '
'; + + toolbarElement.insertAdjacentHTML('beforeend', htmlCode); + } + }); +}); + // Custom SOGo JS // Change the visible font-size in the editor, this does not change the font of a html message by default @@ -5,3 +51,4 @@ CKEDITOR.addCss("body {font-size: 16px !important}"); // Enable scayt by default //CKEDITOR.config.scayt_autoStartup = true; + diff --git a/data/conf/sogo/plist_ldap b/data/conf/sogo/plist_ldap.sh old mode 100644 new mode 100755 similarity index 85% rename from data/conf/sogo/plist_ldap rename to data/conf/sogo/plist_ldap.sh index d585a494f..c35949c65 --- a/data/conf/sogo/plist_ldap +++ b/data/conf/sogo/plist_ldap.sh @@ -1,28 +1,34 @@ - +#!/bin/bash + +domain="$1" +gal_status="$2" + +echo ' + ' diff --git a/data/web/inc/functions.auth.inc.php b/data/web/inc/functions.auth.inc.php index 7183cc8c1..6075ab764 100644 --- a/data/web/inc/functions.auth.inc.php +++ b/data/web/inc/functions.auth.inc.php @@ -4,22 +4,31 @@ function check_login($user, $pass, $app_passwd_data = false, $extra = null) { global $redis; $is_internal = $extra['is_internal']; + $role = $extra['role']; // Try validate admin - $result = admin_login($user, $pass); - if ($result !== false) return $result; + if (!isset($role) || $role == "admin") { + $result = admin_login($user, $pass); + if ($result !== false) return $result; + } // Try validate domain admin - $result = domainadmin_login($user, $pass); - if ($result !== false) return $result; + if (!isset($role) || $role == "domain_admin") { + $result = domainadmin_login($user, $pass); + if ($result !== false) return $result; + } // Try validate user - $result = user_login($user, $pass); - if ($result !== false) return $result; + if (!isset($role) || $role == "user") { + $result = user_login($user, $pass); + if ($result !== false) return $result; + } // Try validate app password - $result = apppass_login($user, $pass, $app_passwd_data); - if ($result !== false) return $result; + if (!isset($role) || $role == "app") { + $result = apppass_login($user, $pass, $app_passwd_data); + if ($result !== false) return $result; + } // skip log and only return false if it's an internal request if ($is_internal == true) return false; @@ -175,62 +184,136 @@ function user_login($user, $pass, $extra = null){ $stmt->execute(array(':user' => $user)); $row = $stmt->fetch(PDO::FETCH_ASSOC); - // user does not exist, try call keycloak login and create user if possible via rest flow + // user does not exist, try call idp login and create user if possible via rest flow if (!$row){ $iam_settings = identity_provider('get'); if ($iam_settings['authsource'] == 'keycloak' && intval($iam_settings['mailpassword_flow']) == 1){ $result = keycloak_mbox_login_rest($user, $pass, $iam_settings, array('is_internal' => $is_internal, 'create' => true)); if ($result !== false) return $result; + } else if ($iam_settings['authsource'] == 'ldap') { + $result = ldap_mbox_login($user, $pass, $iam_settings, array('is_internal' => $is_internal, 'create' => true)); + if ($result !== false) return $result; } } if ($row['active'] != 1) { return false; } - if ($row['authsource'] == 'keycloak'){ - // user authsource is keycloak, try using via rest flow - $iam_settings = identity_provider('get'); - if (intval($iam_settings['mailpassword_flow']) == 1){ - $result = keycloak_mbox_login_rest($user, $pass, $iam_settings, array('is_internal' => $is_internal)); + switch ($row['authsource']) { + case 'keycloak': + // user authsource is keycloak, try using via rest flow + $iam_settings = identity_provider('get'); + if (intval($iam_settings['mailpassword_flow']) == 1){ + $result = keycloak_mbox_login_rest($user, $pass, $iam_settings, array('is_internal' => $is_internal)); + if ($result !== false) { + // check for tfa authenticators + $authenticators = get_tfa($user); + if (isset($authenticators['additional']) && is_array($authenticators['additional']) && count($authenticators['additional']) > 0 && !$is_internal) { + // authenticators found, init TFA flow + $_SESSION['pending_mailcow_cc_username'] = $user; + $_SESSION['pending_mailcow_cc_role'] = "user"; + $_SESSION['pending_tfa_methods'] = $authenticators['additional']; + unset($_SESSION['ldelay']); + $_SESSION['return'][] = array( + 'type' => 'success', + 'log' => array(__FUNCTION__, $user, '*'), + 'msg' => array('logged_in_as', $user) + ); + return "pending"; + } else if (!isset($authenticators['additional']) || !is_array($authenticators['additional']) || count($authenticators['additional']) == 0) { + // no authenticators found, login successfull + if (!$is_internal){ + unset($_SESSION['ldelay']); + // Reactivate TFA if it was set to "deactivate TFA for next login" + $stmt = $pdo->prepare("UPDATE `tfa` SET `active`='1' WHERE `username` = :user"); + $stmt->execute(array(':user' => $user)); + $_SESSION['return'][] = array( + 'type' => 'success', + 'log' => array(__FUNCTION__, $user, '*'), + 'msg' => array('logged_in_as', $user) + ); + } + return "user"; + } + } + return $result; + } else { + return false; + } + break; + case 'ldap': + // user authsource is ldap + $iam_settings = identity_provider('get'); + $result = ldap_mbox_login($user, $pass, $iam_settings, array('is_internal' => $is_internal)); + if ($result !== false) { + // check for tfa authenticators + $authenticators = get_tfa($user); + if (isset($authenticators['additional']) && is_array($authenticators['additional']) && count($authenticators['additional']) > 0 && !$is_internal) { + // authenticators found, init TFA flow + $_SESSION['pending_mailcow_cc_username'] = $user; + $_SESSION['pending_mailcow_cc_role'] = "user"; + $_SESSION['pending_tfa_methods'] = $authenticators['additional']; + unset($_SESSION['ldelay']); + $_SESSION['return'][] = array( + 'type' => 'success', + 'log' => array(__FUNCTION__, $user, '*'), + 'msg' => array('logged_in_as', $user) + ); + return "pending"; + } else if (!isset($authenticators['additional']) || !is_array($authenticators['additional']) || count($authenticators['additional']) == 0) { + // no authenticators found, login successfull + if (!$is_internal){ + unset($_SESSION['ldelay']); + // Reactivate TFA if it was set to "deactivate TFA for next login" + $stmt = $pdo->prepare("UPDATE `tfa` SET `active`='1' WHERE `username` = :user"); + $stmt->execute(array(':user' => $user)); + $_SESSION['return'][] = array( + 'type' => 'success', + 'log' => array(__FUNCTION__, $user, '*'), + 'msg' => array('logged_in_as', $user) + ); + } + return "user"; + } + } return $result; - } else { - return false; - } + break; + default: + // verify password + if (verify_hash($row['password'], $pass) !== false) { + // check for tfa authenticators + $authenticators = get_tfa($user); + if (isset($authenticators['additional']) && is_array($authenticators['additional']) && count($authenticators['additional']) > 0 && !$is_internal) { + // authenticators found, init TFA flow + $_SESSION['pending_mailcow_cc_username'] = $user; + $_SESSION['pending_mailcow_cc_role'] = "user"; + $_SESSION['pending_tfa_methods'] = $authenticators['additional']; + unset($_SESSION['ldelay']); + $_SESSION['return'][] = array( + 'type' => 'success', + 'log' => array(__FUNCTION__, $user, '*'), + 'msg' => array('logged_in_as', $user) + ); + return "pending"; + } else if (!isset($authenticators['additional']) || !is_array($authenticators['additional']) || count($authenticators['additional']) == 0) { + // no authenticators found, login successfull + if (!$is_internal){ + unset($_SESSION['ldelay']); + // Reactivate TFA if it was set to "deactivate TFA for next login" + $stmt = $pdo->prepare("UPDATE `tfa` SET `active`='1' WHERE `username` = :user"); + $stmt->execute(array(':user' => $user)); + $_SESSION['return'][] = array( + 'type' => 'success', + 'log' => array(__FUNCTION__, $user, '*'), + 'msg' => array('logged_in_as', $user) + ); + } + return "user"; + } + } + break; } - // verify password - if (verify_hash($row['password'], $pass) !== false) { - // check for tfa authenticators - $authenticators = get_tfa($user); - if (isset($authenticators['additional']) && is_array($authenticators['additional']) && count($authenticators['additional']) > 0 && !$is_internal) { - // authenticators found, init TFA flow - $_SESSION['pending_mailcow_cc_username'] = $user; - $_SESSION['pending_mailcow_cc_role'] = "user"; - $_SESSION['pending_tfa_methods'] = $authenticators['additional']; - unset($_SESSION['ldelay']); - $_SESSION['return'][] = array( - 'type' => 'success', - 'log' => array(__FUNCTION__, $user, '*'), - 'msg' => array('logged_in_as', $user) - ); - return "pending"; - } else if (!isset($authenticators['additional']) || !is_array($authenticators['additional']) || count($authenticators['additional']) == 0) { - // no authenticators found, login successfull - if (!$is_internal){ - unset($_SESSION['ldelay']); - // Reactivate TFA if it was set to "deactivate TFA for next login" - $stmt = $pdo->prepare("UPDATE `tfa` SET `active`='1' WHERE `username` = :user"); - $stmt->execute(array(':user' => $user)); - $_SESSION['return'][] = array( - 'type' => 'success', - 'log' => array(__FUNCTION__, $user, '*'), - 'msg' => array('logged_in_as', $user) - ); - } - return "user"; - } - } - return false; } function apppass_login($user, $pass, $app_passwd_data, $extra = null){ @@ -372,11 +455,6 @@ function keycloak_mbox_login_rest($user, $pass, $iam_settings, $extra = null){ return false; } else if (!$create) { // login success - dont create mailbox - $_SESSION['return'][] = array( - 'type' => 'success', - 'log' => array(__FUNCTION__, $user, '*'), - 'msg' => array('logged_in_as', $user) - ); return 'user'; } @@ -388,16 +466,71 @@ function keycloak_mbox_login_rest($user, $pass, $iam_settings, $extra = null){ $create_res = mailbox('add', 'mailbox_from_template', array( 'domain' => explode('@', $user)[1], 'local_part' => explode('@', $user)[0], + 'name' => $user_res['firstName'] . " " . $user_res['lastName'], 'authsource' => 'keycloak', - 'template' => $iam_settings['mappers'][$mapper_key] + 'template' => $iam_settings['templates'][$mapper_key] + )); + if (!$create_res) return false; + + return 'user'; +} +function ldap_mbox_login($user, $pass, $iam_settings, $extra = null){ + global $pdo; + global $iam_provider; + + $is_internal = $extra['is_internal']; + $create = $extra['create']; + + if (!filter_var($user, FILTER_VALIDATE_EMAIL) && !ctype_alnum(str_replace(array('_', '.', '-'), '', $user))) { + if (!$is_internal){ + $_SESSION['return'][] = array( + 'type' => 'danger', + 'log' => array(__FUNCTION__, $user, '*'), + 'msg' => 'malformed_username' + ); + } + return false; + } + + try { + $ldap_query = $iam_provider->query() + ->where($iam_settings['username_field'], '=', $user) + ->select([$iam_settings['username_field'], $iam_settings['attribute_field'], 'displayname', 'distinguishedname']); + if (!empty($iam_settings['filter'])) { + $ldap_query = $ldap_query->whereRaw($iam_settings['filter']); + } + + $user_res = $ldap_query->firstOrFail(); + } catch (Exception $e) { + return false; + } + if (!$iam_provider->auth()->attempt($user_res['distinguishedname'][0], $pass)) { + return false; + } + + // get mapped template, if not set return false + // also return false if no mappers were defined + $user_template = $user_res[$iam_settings['attribute_field']][0]; + if ($create && (empty($iam_settings['mappers']) || !$user_template)){ + return false; + } else if (!$create) { + // login success - dont create mailbox + return 'user'; + } + + // check if matching attribute exist + $mapper_key = array_search($user_template, $iam_settings['mappers']); + if ($mapper_key === false) return false; + + // create mailbox + $create_res = mailbox('add', 'mailbox_from_template', array( + 'domain' => explode('@', $user)[1], + 'local_part' => explode('@', $user)[0], + 'name' => $user_res['displayname'][0], + 'authsource' => 'ldap', + 'template' => $iam_settings['templates'][$mapper_key] )); if (!$create_res) return false; - - $_SESSION['return'][] = array( - 'type' => 'success', - 'log' => array(__FUNCTION__, $user, '*'), - 'msg' => array('logged_in_as', $user) - ); return 'user'; } diff --git a/data/web/inc/functions.inc.php b/data/web/inc/functions.inc.php index 215a95fdd..94d81e9ea 100644 --- a/data/web/inc/functions.inc.php +++ b/data/web/inc/functions.inc.php @@ -840,6 +840,11 @@ function update_sogo_static_view($mailbox = null) { } } + // generate random password for sogo to deny direct login + $random_password = base64_encode(openssl_random_pseudo_bytes(24)); + $random_salt = base64_encode(openssl_random_pseudo_bytes(16)); + $random_hash = '{SSHA256}' . base64_encode(hash('sha256', base64_decode($password) . $salt, true) . $salt); + $subquery = "GROUP BY mailbox.username"; if ($mailbox_exists) { $subquery = "AND mailbox.username = :mailbox"; @@ -849,13 +854,7 @@ function update_sogo_static_view($mailbox = null) { mailbox.username, mailbox.domain, mailbox.username, - CASE - WHEN mailbox.authsource IS NOT NULL AND mailbox.authsource <> 'mailcow' THEN '{SSHA256}A123A123A321A321A321B321B321B123B123B321B432F123E321123123321321' - ELSE - IF(JSON_UNQUOTE(JSON_VALUE(attributes, '$.force_pw_update')) = '0', - IF(JSON_UNQUOTE(JSON_VALUE(attributes, '$.sogo_access')) = 1, password, '{SSHA256}A123A123A321A321A321B321B321B123B123B321B432F123E321123123321321'), - '{SSHA256}A123A123A321A321A321B321B321B123B123B321B432F123E321123123321321') - END AS c_password, + :random_hash, mailbox.name, mailbox.username, IFNULL(GROUP_CONCAT(ga.aliases ORDER BY ga.aliases SEPARATOR ' '), ''), @@ -886,9 +885,15 @@ function update_sogo_static_view($mailbox = null) { if ($mailbox_exists) { $stmt = $pdo->prepare($query); - $stmt->execute(array(':mailbox' => $mailbox)); + $stmt->execute(array( + ':random_hash' => $random_hash, + ':mailbox' => $mailbox + )); } else { - $stmt = $pdo->query($query); + $stmt = $pdo->prepare($query); + $stmt->execute(array( + ':random_hash' => $random_hash + )); } $stmt = $pdo->query("DELETE FROM _sogo_static_view WHERE `c_uid` NOT IN (SELECT `username` FROM `mailbox` WHERE `active` = '1');"); @@ -1060,13 +1065,19 @@ function set_tfa($_data) { // check mailbox confirm password if ($access_denied === null) { - $stmt = $pdo->prepare("SELECT `password` FROM `mailbox` + $stmt = $pdo->prepare("SELECT `password`, `authsource` FROM `mailbox` WHERE `username` = :username"); $stmt->execute(array(':username' => $username)); $row = $stmt->fetch(PDO::FETCH_ASSOC); if ($row) { - if (!verify_hash($row['password'], $_data["confirm_password"])) $access_denied = true; - else $access_denied = false; + if ($row['authsource'] == 'ldap'){ + $iam_settings = identity_provider('get'); + if (!ldap_mbox_login($username, $_data["confirm_password"], $iam_settings)) $access_denied = true; + else $access_denied = false; + } else { + if (!verify_hash($row['password'], $_data["confirm_password"])) $access_denied = true; + else $access_denied = false; + } } } @@ -2129,12 +2140,18 @@ function identity_provider($_action, $_data = null, $_extra = null) { $_SESSION['return'][] = array( 'type' => 'danger', 'log' => array(__FUNCTION__, $_action, $data_log), - 'msg' => array('required_data_missing', $setting) + 'msg' => array('required_data_missing', '') ); return false; } + + $available_authsources = array( + "keycloak", + "generic-oidc", + "ldap" + ); $_data['authsource'] = strtolower($_data['authsource']); - if ($_data['authsource'] != "keycloak" && $_data['authsource'] != "generic-oidc"){ + if (!in_array($_data['authsource'], $available_authsources)){ $_SESSION['return'][] = array( 'type' => 'danger', 'log' => array(__FUNCTION__, $_action, $data_log), @@ -2158,20 +2175,33 @@ function identity_provider($_action, $_data = null, $_extra = null) { return false; } - if ($_data['authsource'] == "keycloak") { - $_data['server_url'] = (!empty($_data['server_url'])) ? rtrim($_data['server_url'], '/') : null; - $_data['mailpassword_flow'] = isset($_data['mailpassword_flow']) ? intval($_data['mailpassword_flow']) : 0; - $_data['periodic_sync'] = isset($_data['periodic_sync']) ? intval($_data['periodic_sync']) : 0; - $_data['import_users'] = isset($_data['import_users']) ? intval($_data['import_users']) : 0; - $_data['sync_interval'] = isset($_data['sync_interval']) ? intval($_data['sync_interval']) : 15; - $_data['sync_interval'] = $_data['sync_interval'] < 1 ? 1 : $_data['sync_interval']; - $required_settings = array('authsource', 'server_url', 'realm', 'client_id', 'client_secret', 'redirect_url', 'version', 'mailpassword_flow', 'periodic_sync', 'import_users', 'sync_interval'); - } else if ($_data['authsource'] == "generic-oidc") { - $_data['authorize_url'] = (!empty($_data['authorize_url'])) ? $_data['authorize_url'] : null; - $_data['token_url'] = (!empty($_data['token_url'])) ? $_data['token_url'] : null; - $_data['userinfo_url'] = (!empty($_data['userinfo_url'])) ? $_data['userinfo_url'] : null; - $_data['client_scopes'] = (!empty($_data['client_scopes'])) ? $_data['client_scopes'] : "openid profile email"; - $required_settings = array('authsource', 'authorize_url', 'token_url', 'client_id', 'client_secret', 'redirect_url', 'userinfo_url', 'client_scopes'); + switch ($_data['authsource']) { + case "keycloak": + $_data['server_url'] = (!empty($_data['server_url'])) ? rtrim($_data['server_url'], '/') : null; + $_data['mailpassword_flow'] = isset($_data['mailpassword_flow']) ? intval($_data['mailpassword_flow']) : 0; + $_data['periodic_sync'] = isset($_data['periodic_sync']) ? intval($_data['periodic_sync']) : 0; + $_data['import_users'] = isset($_data['import_users']) ? intval($_data['import_users']) : 0; + $_data['sync_interval'] = (!empty($_data['sync_interval'])) ? intval($_data['sync_interval']) : 15; + $_data['sync_interval'] = $_data['sync_interval'] < 1 ? 1 : $_data['sync_interval']; + $required_settings = array('authsource', 'server_url', 'realm', 'client_id', 'client_secret', 'redirect_url', 'version', 'mailpassword_flow', 'periodic_sync', 'import_users', 'sync_interval'); + break; + case "generic-oidc": + $_data['authorize_url'] = (!empty($_data['authorize_url'])) ? $_data['authorize_url'] : null; + $_data['token_url'] = (!empty($_data['token_url'])) ? $_data['token_url'] : null; + $_data['userinfo_url'] = (!empty($_data['userinfo_url'])) ? $_data['userinfo_url'] : null; + $_data['client_scopes'] = (!empty($_data['client_scopes'])) ? $_data['client_scopes'] : "openid profile email"; + $required_settings = array('authsource', 'authorize_url', 'token_url', 'client_id', 'client_secret', 'redirect_url', 'userinfo_url', 'client_scopes'); + break; + case "ldap": + $_data['port'] = (!empty($_data['port'])) ? intval($_data['port']) : 389; + $_data['username_field'] = (!empty($_data['username_field'])) ? $_data['username_field'] : "mail"; + $_data['filter'] = (!empty($_data['filter'])) ? $_data['filter'] : ""; + $_data['periodic_sync'] = isset($_data['periodic_sync']) ? intval($_data['periodic_sync']) : 0; + $_data['import_users'] = isset($_data['import_users']) ? intval($_data['import_users']) : 0; + $_data['sync_interval'] = (!empty($_data['sync_interval'])) ? intval($_data['sync_interval']) : 15; + $_data['sync_interval'] = $_data['sync_interval'] < 1 ? 1 : $_data['sync_interval']; + $required_settings = array('authsource', 'host', 'port', 'basedn', 'username_field', 'filter', 'attribute_field', 'binddn', 'bindpass', 'periodic_sync', 'import_users', 'sync_interval'); + break; } $pdo->beginTransaction(); @@ -2234,30 +2264,56 @@ function identity_provider($_action, $_data = null, $_extra = null) { return false; } - if ($_data['authsource'] == 'keycloak') { - $url = "{$_data['server_url']}/realms/{$_data['realm']}/protocol/openid-connect/token"; - } else { - $url = $_data['token_url']; - } - $req = http_build_query(array( - 'grant_type' => 'client_credentials', - 'client_id' => $_data['client_id'], - 'client_secret' => $_data['client_secret'] - )); - $curl = curl_init(); - curl_setopt($curl, CURLOPT_URL, $url); - curl_setopt($curl, CURLOPT_TIMEOUT, 7); - curl_setopt($curl, CURLOPT_POST, 1); - curl_setopt($curl, CURLOPT_POSTFIELDS, $req); - curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded')); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); - $res = curl_exec($curl); - $code = curl_getinfo($curl, CURLINFO_HTTP_CODE); - curl_close ($curl); - - if ($code != 200) { - return false; + switch ($_data['authsource']) { + case 'keycloak': + case 'generic-oidc': + if ($_data['authsource'] == 'keycloak') { + $url = "{$_data['server_url']}/realms/{$_data['realm']}/protocol/openid-connect/token"; + } else { + $url = $_data['token_url']; + } + $req = http_build_query(array( + 'grant_type' => 'client_credentials', + 'client_id' => $_data['client_id'], + 'client_secret' => $_data['client_secret'] + )); + $curl = curl_init(); + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_TIMEOUT, 7); + curl_setopt($curl, CURLOPT_POST, 1); + curl_setopt($curl, CURLOPT_POSTFIELDS, $req); + curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded')); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); + $res = curl_exec($curl); + $code = curl_getinfo($curl, CURLINFO_HTTP_CODE); + curl_close ($curl); + + if ($code != 200) { + return false; + } + break; + case 'ldap': + if (!$_data['host'] || !$_data['port'] || !$_data['basedn'] || + !$_data['binddn'] || !$_data['bindpass']){ + return false; + } + $provider = new \LdapRecord\Connection([ + 'hosts' => [$_data['host']], + 'port' => $_data['port'], + 'base_dn' => $_data['basedn'], + 'username' => $_data['binddn'], + 'password' => $_data['bindpass'] + ]); + try { + $provider->connect(); + } catch (TypeError $e) { + return false; + } catch (\LdapRecord\Auth\BindException $e) { + return false; + } + break; } + return true; break; case "delete": @@ -2295,40 +2351,70 @@ function identity_provider($_action, $_data = null, $_extra = null) { case "init": $iam_settings = identity_provider('get'); $provider = null; - if ($iam_settings['authsource'] == 'keycloak'){ - if ($iam_settings['server_url'] && $iam_settings['realm'] && $iam_settings['client_id'] && + + switch ($iam_settings['authsource']) { + case "keycloak": + if ($iam_settings['server_url'] && $iam_settings['realm'] && $iam_settings['client_id'] && $iam_settings['client_secret'] && $iam_settings['redirect_url'] && $iam_settings['version']){ - $provider = new Stevenmaguire\OAuth2\Client\Provider\Keycloak([ - 'authServerUrl' => $iam_settings['server_url'], - 'realm' => $iam_settings['realm'], - 'clientId' => $iam_settings['client_id'], - 'clientSecret' => $iam_settings['client_secret'], - 'redirectUri' => $iam_settings['redirect_url'], - 'version' => $iam_settings['version'], - // 'encryptionAlgorithm' => 'RS256', // optional - // 'encryptionKeyPath' => '../key.pem' // optional - // 'encryptionKey' => 'contents_of_key_or_certificate' // optional - ]); - } - } - else if ($iam_settings['authsource'] == 'generic-oidc'){ - if ($iam_settings['client_id'] && $iam_settings['client_secret'] && $iam_settings['redirect_url'] && + $provider = new Stevenmaguire\OAuth2\Client\Provider\Keycloak([ + 'authServerUrl' => $iam_settings['server_url'], + 'realm' => $iam_settings['realm'], + 'clientId' => $iam_settings['client_id'], + 'clientSecret' => $iam_settings['client_secret'], + 'redirectUri' => $iam_settings['redirect_url'], + 'version' => $iam_settings['version'], + // 'encryptionAlgorithm' => 'RS256', // optional + // 'encryptionKeyPath' => '../key.pem' // optional + // 'encryptionKey' => 'contents_of_key_or_certificate' // optional + ]); + } + break; + case "generic-oidc": + if ($iam_settings['client_id'] && $iam_settings['client_secret'] && $iam_settings['redirect_url'] && $iam_settings['authorize_url'] && $iam_settings['token_url'] && $iam_settings['userinfo_url']){ - $provider = new \League\OAuth2\Client\Provider\GenericProvider([ - 'clientId' => $iam_settings['client_id'], - 'clientSecret' => $iam_settings['client_secret'], - 'redirectUri' => $iam_settings['redirect_url'], - 'urlAuthorize' => $iam_settings['authorize_url'], - 'urlAccessToken' => $iam_settings['token_url'], - 'urlResourceOwnerDetails' => $iam_settings['userinfo_url'], - 'scopes' => $iam_settings['client_scopes'] - ]); - } + $provider = new \League\OAuth2\Client\Provider\GenericProvider([ + 'clientId' => $iam_settings['client_id'], + 'clientSecret' => $iam_settings['client_secret'], + 'redirectUri' => $iam_settings['redirect_url'], + 'urlAuthorize' => $iam_settings['authorize_url'], + 'urlAccessToken' => $iam_settings['token_url'], + 'urlResourceOwnerDetails' => $iam_settings['userinfo_url'], + 'scopes' => $iam_settings['client_scopes'] + ]); + } + break; + case "ldap": + if ($iam_settings['host'] && $iam_settings['port'] && $iam_settings['basedn'] && + $iam_settings['binddn'] && $iam_settings['bindpass']){ + $provider = new \LdapRecord\Connection([ + 'hosts' => [$iam_settings['host']], + 'port' => $iam_settings['port'], + 'base_dn' => $iam_settings['basedn'], + 'username' => $iam_settings['binddn'], + 'password' => $iam_settings['bindpass'] + ]); + try { + $provider->connect(); + } catch (TypeError $e) { + $provider = null; + } + } + break; } + return $provider; break; case "verify-sso": $provider = $_data['iam_provider']; + $iam_settings = identity_provider('get'); + if ($iam_settings['authsource'] != 'keycloak' && $iam_settings['authsource'] != 'generic-oidc'){ + $_SESSION['return'][] = array( + 'type' => 'danger', + 'log' => array(__FUNCTION__), + 'msg' => array('login_failed', "no OIDC provider configured") + ); + return false; + } try { $token = $provider->getAccessToken('authorization_code', ['code' => $_GET['code']]); @@ -2358,8 +2444,7 @@ function identity_provider($_action, $_data = null, $_extra = null) { $row = $stmt->fetch(PDO::FETCH_ASSOC); if ($row){ // success - $_SESSION['mailcow_cc_username'] = $info['email']; - $_SESSION['mailcow_cc_role'] = "user"; + set_user_loggedin_session($info['email']); $_SESSION['return'][] = array( 'type' => 'success', 'log' => array(__FUNCTION__, $_SESSION['mailcow_cc_username'], $_SESSION['mailcow_cc_role']), @@ -2370,9 +2455,8 @@ function identity_provider($_action, $_data = null, $_extra = null) { // get mapped template, if not set return false // also return false if no mappers were defined - $provider = identity_provider('get'); $user_template = $info['mailcow_template']; - if (empty($provider['mappers']) || empty($user_template)){ + if (empty($iam_settings['mappers']) || empty($user_template)){ clear_session(); $_SESSION['return'][] = array( 'type' => 'danger', @@ -2383,7 +2467,7 @@ function identity_provider($_action, $_data = null, $_extra = null) { } // check if matching attribute exist - $mapper_key = array_search($user_template, $provider['mappers']); + $mapper_key = array_search($user_template, $iam_settings['mappers']); if ($mapper_key === false) { clear_session(); $_SESSION['return'][] = array( @@ -2398,8 +2482,9 @@ function identity_provider($_action, $_data = null, $_extra = null) { $create_res = mailbox('add', 'mailbox_from_template', array( 'domain' => explode('@', $info['email'])[1], 'local_part' => explode('@', $info['email'])[0], - 'authsource' => identity_provider('get')['authsource'], - 'template' => $provider['templates'][$mapper_key] + 'name' => $info['firstName'] . " " . $info['lastName'], + 'authsource' => $iam_settings['authsource'], + 'template' => $iam_settings['templates'][$mapper_key] )); if (!$create_res){ clear_session(); @@ -2411,8 +2496,7 @@ function identity_provider($_action, $_data = null, $_extra = null) { return false; } - $_SESSION['mailcow_cc_username'] = $info['email']; - $_SESSION['mailcow_cc_role'] = "user"; + set_user_loggedin_session($info['email']); $_SESSION['return'][] = array( 'type' => 'success', 'log' => array(__FUNCTION__, $_SESSION['mailcow_cc_username'], $_SESSION['mailcow_cc_role']), @@ -2429,10 +2513,11 @@ function identity_provider($_action, $_data = null, $_extra = null) { $_SESSION['iam_refresh_token'] = $token->getRefreshToken(); $info = $provider->getResourceOwner($token)->toArray(); } catch (Throwable $e) { + clear_session(); $_SESSION['return'][] = array( 'type' => 'danger', 'log' => array(__FUNCTION__), - 'msg' => array('login_failed', $e->getMessage()) + 'msg' => array('refresh_login_failed', $e->getMessage()) ); return false; } @@ -2452,6 +2537,9 @@ function identity_provider($_action, $_data = null, $_extra = null) { return true; break; case "get-redirect": + $iam_settings = identity_provider('get'); + if ($iam_settings['authsource'] != 'keycloak' && $iam_settings['authsource'] != 'generic-oidc') + return false; $provider = $_data['iam_provider']; $authUrl = $provider->getAuthorizationUrl(); $_SESSION['oauth2state'] = $provider->getState(); @@ -2522,7 +2610,16 @@ function clear_session(){ session_destroy(); session_write_close(); } - +function set_user_loggedin_session($user) { + $_SESSION['mailcow_cc_username'] = $user; + $_SESSION['mailcow_cc_role'] = 'user'; + $sogo_sso_pass = file_get_contents("/etc/sogo-sso/sogo-sso.pass"); + $_SESSION['sogo-sso-user-allowed'][] = $user; + $_SESSION['sogo-sso-pass'] = $sogo_sso_pass; + unset($_SESSION['pending_mailcow_cc_username']); + unset($_SESSION['pending_mailcow_cc_role']); + unset($_SESSION['pending_tfa_methods']); +} function get_logs($application, $lines = false) { if ($lines === false) { $lines = $GLOBALS['LOG_LINES'] - 1; diff --git a/data/web/inc/functions.mailbox.inc.php b/data/web/inc/functions.mailbox.inc.php index 46658274e..939958d29 100644 --- a/data/web/inc/functions.mailbox.inc.php +++ b/data/web/inc/functions.mailbox.inc.php @@ -1019,7 +1019,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ); return false; } - if (in_array($_data['authsource'], array('mailcow', 'keycloak', 'generic-oidc'))){ + if (in_array($_data['authsource'], array('mailcow', 'keycloak', 'generic-oidc', 'ldap'))){ $authsource = $_data['authsource']; } if (empty($name)) { @@ -2944,7 +2944,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { $tags = (is_array($_data['tags']) ? $_data['tags'] : array()); $attribute_hash = (!empty($_data['attribute_hash'])) ? $_data['attribute_hash'] : ''; $authsource = $is_now['authsource']; - if (in_array($_data['authsource'], array('mailcow', 'keycloak', 'generic-oidc'))){ + if (in_array($_data['authsource'], array('mailcow', 'keycloak', 'generic-oidc', 'ldap'))){ $authsource = $_data['authsource']; } } @@ -3285,11 +3285,13 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { $attribute_hash = sha1(json_encode($mbox_template_data["attributes"])); $is_now = mailbox('get', 'mailbox_details', $_data['username']); - if ($is_now['attributes']['attribute_hash'] == $attribute_hash) + $name = ltrim(rtrim($_data['name'], '>'), '<'); + if ($is_now['attributes']['attribute_hash'] == $attribute_hash && $is_now['name'] == $name) return true; $mbox_template_data = json_decode($mbox_template_data["attributes"], true); $mbox_template_data['attribute_hash'] = $attribute_hash; + $mbox_template_data['name'] = $name; $quarantine_attributes = array('username' => $_data['username']); $tls_attributes = array('username' => $_data['username']); $ratelimit_attributes = array('object' => $_data['username']); diff --git a/data/web/inc/init_db.inc.php b/data/web/inc/init_db.inc.php index 4f73911a6..afacbc724 100644 --- a/data/web/inc/init_db.inc.php +++ b/data/web/inc/init_db.inc.php @@ -362,7 +362,7 @@ function init_db_schema() { "custom_attributes" => "JSON NOT NULL DEFAULT ('{}')", "kind" => "VARCHAR(100) NOT NULL DEFAULT ''", "multiple_bookings" => "INT NOT NULL DEFAULT -1", - "authsource" => "ENUM('mailcow', 'keycloak', 'generic-oidc') DEFAULT 'mailcow'", + "authsource" => "ENUM('mailcow', 'keycloak', 'generic-oidc', 'ldap') DEFAULT 'mailcow'", "created" => "DATETIME(0) NOT NULL DEFAULT NOW(0)", "modified" => "DATETIME ON UPDATE CURRENT_TIMESTAMP", "active" => "TINYINT(1) NOT NULL DEFAULT '1'" diff --git a/data/web/inc/lib/composer.json b/data/web/inc/lib/composer.json index a803291f8..91a50bcbf 100644 --- a/data/web/inc/lib/composer.json +++ b/data/web/inc/lib/composer.json @@ -8,7 +8,7 @@ "matthiasmullie/minify": "^1.3", "bshaffer/oauth2-server-php": "^1.11", "mustangostang/spyc": "^0.6.3", - "directorytree/ldaprecord": "^2.4", + "directorytree/ldaprecord": "^3.3", "twig/twig": "^3.0", "stevenmaguire/oauth2-keycloak": "^4.0", "league/oauth2-client": "^2.7" diff --git a/data/web/inc/lib/composer.lock b/data/web/inc/lib/composer.lock index 516e9fec3..f0659ee80 100644 --- a/data/web/inc/lib/composer.lock +++ b/data/web/inc/lib/composer.lock @@ -68,6 +68,75 @@ }, "time": "2018-12-04T00:29:32+00:00" }, + { + "name": "carbonphp/carbon-doctrine-types", + "version": "3.2.0", + "source": { + "type": "git", + "url": "https://github.com/CarbonPHP/carbon-doctrine-types.git", + "reference": "18ba5ddfec8976260ead6e866180bd5d2f71aa1d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/CarbonPHP/carbon-doctrine-types/zipball/18ba5ddfec8976260ead6e866180bd5d2f71aa1d", + "reference": "18ba5ddfec8976260ead6e866180bd5d2f71aa1d", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "conflict": { + "doctrine/dbal": "<4.0.0 || >=5.0.0" + }, + "require-dev": { + "doctrine/dbal": "^4.0.0", + "nesbot/carbon": "^2.71.0 || ^3.0.0", + "phpunit/phpunit": "^10.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Carbon\\Doctrine\\": "src/Carbon/Doctrine/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "KyleKatarn", + "email": "kylekatarnls@gmail.com" + } + ], + "description": "Types to use Carbon in Doctrine", + "keywords": [ + "carbon", + "date", + "datetime", + "doctrine", + "time" + ], + "support": { + "issues": "https://github.com/CarbonPHP/carbon-doctrine-types/issues", + "source": "https://github.com/CarbonPHP/carbon-doctrine-types/tree/3.2.0" + }, + "funding": [ + { + "url": "https://github.com/kylekatarnls", + "type": "github" + }, + { + "url": "https://opencollective.com/Carbon", + "type": "open_collective" + }, + { + "url": "https://tidelift.com/funding/github/packagist/nesbot/carbon", + "type": "tidelift" + } + ], + "time": "2024-02-09T16:56:22+00:00" + }, { "name": "ddeboer/imap", "version": "1.13.1", @@ -145,27 +214,28 @@ }, { "name": "directorytree/ldaprecord", - "version": "v2.10.1", + "version": "v2.20.5", "source": { "type": "git", "url": "https://github.com/DirectoryTree/LdapRecord.git", - "reference": "bf512d9af7a7b0e2ed7a666ab29cefdd027bee88" + "reference": "5bd0a5a9d257cf1049ae83055dbba4c3479ddf16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DirectoryTree/LdapRecord/zipball/bf512d9af7a7b0e2ed7a666ab29cefdd027bee88", - "reference": "bf512d9af7a7b0e2ed7a666ab29cefdd027bee88", + "url": "https://api.github.com/repos/DirectoryTree/LdapRecord/zipball/5bd0a5a9d257cf1049ae83055dbba4c3479ddf16", + "reference": "5bd0a5a9d257cf1049ae83055dbba4c3479ddf16", "shasum": "" }, "require": { "ext-json": "*", "ext-ldap": "*", - "illuminate/contracts": "^5.0|^6.0|^7.0|^8.0|^9.0", + "illuminate/contracts": "^5.0|^6.0|^7.0|^8.0|^9.0|^10.0", "nesbot/carbon": "^1.0|^2.0", "php": ">=7.3", - "psr/log": "*", + "psr/log": "^1.0|^2.0|^3.0", "psr/simple-cache": "^1.0|^2.0", - "tightenco/collect": "^5.6|^6.0|^7.0|^8.0" + "symfony/polyfill-php80": "^1.25", + "tightenco/collect": "^5.6|^6.0|^7.0|^8.0|^9.0" }, "require-dev": { "mockery/mockery": "^1.0", @@ -214,7 +284,7 @@ "type": "github" } ], - "time": "2022-02-25T16:00:51+00:00" + "time": "2023-10-11T16:34:34+00:00" }, { "name": "firebase/php-jwt", @@ -609,27 +679,27 @@ }, { "name": "illuminate/contracts", - "version": "v9.3.0", + "version": "v10.44.0", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", - "reference": "bf4b3c254c49d28157645d01e4883b5951b1e1d0" + "reference": "8d7152c4a1f5d9cf7da3e8b71f23e4556f6138ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/contracts/zipball/bf4b3c254c49d28157645d01e4883b5951b1e1d0", - "reference": "bf4b3c254c49d28157645d01e4883b5951b1e1d0", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/8d7152c4a1f5d9cf7da3e8b71f23e4556f6138ac", + "reference": "8d7152c4a1f5d9cf7da3e8b71f23e4556f6138ac", "shasum": "" }, "require": { - "php": "^8.0.2", + "php": "^8.1", "psr/container": "^1.1.1|^2.0.1", "psr/simple-cache": "^1.0|^2.0|^3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "9.x-dev" + "dev-master": "10.x-dev" } }, "autoload": { @@ -653,7 +723,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2022-02-22T14:45:39+00:00" + "time": "2024-01-15T18:52:32+00:00" }, { "name": "league/oauth2-client", @@ -908,34 +978,41 @@ }, { "name": "nesbot/carbon", - "version": "2.57.0", + "version": "2.72.3", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "4a54375c21eea4811dbd1149fe6b246517554e78" + "reference": "0c6fd108360c562f6e4fd1dedb8233b423e91c83" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/4a54375c21eea4811dbd1149fe6b246517554e78", - "reference": "4a54375c21eea4811dbd1149fe6b246517554e78", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/0c6fd108360c562f6e4fd1dedb8233b423e91c83", + "reference": "0c6fd108360c562f6e4fd1dedb8233b423e91c83", "shasum": "" }, "require": { + "carbonphp/carbon-doctrine-types": "*", "ext-json": "*", "php": "^7.1.8 || ^8.0", + "psr/clock": "^1.0", "symfony/polyfill-mbstring": "^1.0", "symfony/polyfill-php80": "^1.16", "symfony/translation": "^3.4 || ^4.0 || ^5.0 || ^6.0" }, + "provide": { + "psr/clock-implementation": "1.0" + }, "require-dev": { - "doctrine/dbal": "^2.0 || ^3.0", - "doctrine/orm": "^2.7", + "doctrine/dbal": "^2.0 || ^3.1.4 || ^4.0", + "doctrine/orm": "^2.7 || ^3.0", "friendsofphp/php-cs-fixer": "^3.0", "kylekatarnls/multi-tester": "^2.0", + "ondrejmirtes/better-reflection": "*", "phpmd/phpmd": "^2.9", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.12.54 || ^1.0", - "phpunit/phpunit": "^7.5.20 || ^8.5.14", + "phpstan/phpstan": "^0.12.99 || ^1.7.14", + "phpunit/php-file-iterator": "^2.0.5 || ^3.0.6", + "phpunit/phpunit": "^7.5.20 || ^8.5.26 || ^9.5.20", "squizlabs/php_codesniffer": "^3.4" }, "bin": [ @@ -992,15 +1069,19 @@ }, "funding": [ { - "url": "https://opencollective.com/Carbon", - "type": "open_collective" + "url": "https://github.com/sponsors/kylekatarnls", + "type": "github" }, { - "url": "https://tidelift.com/funding/github/packagist/nesbot/carbon", + "url": "https://opencollective.com/Carbon#sponsor", + "type": "opencollective" + }, + { + "url": "https://tidelift.com/subscription/pkg/packagist-nesbot-carbon?utm_source=packagist-nesbot-carbon&utm_medium=referral&utm_campaign=readme", "type": "tidelift" } ], - "time": "2022-02-13T18:13:33+00:00" + "time": "2024-01-25T10:35:09+00:00" }, { "name": "paragonie/random_compat", @@ -1221,6 +1302,54 @@ ], "time": "2022-02-28T15:31:21+00:00" }, + { + "name": "psr/clock", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "time": "2022-11-25T14:36:26+00:00" + }, { "name": "psr/container", "version": "2.0.2", @@ -1767,16 +1896,16 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v3.2.1", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e" + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", - "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", "shasum": "" }, "require": { @@ -1785,7 +1914,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -1814,7 +1943,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.1" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.4.0" }, "funding": [ { @@ -1830,7 +1959,7 @@ "type": "tidelift" } ], - "time": "2023-03-01T10:25:55+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1916,16 +2045,16 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.24.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", - "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", "shasum": "" }, "require": { @@ -1939,9 +2068,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -1979,7 +2105,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" }, "funding": [ { @@ -1995,20 +2121,20 @@ "type": "tidelift" } ], - "time": "2021-11-30T18:21:41+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.24.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9" + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/57b712b08eddb97c762a8caa32c84e037892d2e9", - "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", "shasum": "" }, "require": { @@ -2016,9 +2142,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -2062,7 +2185,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0" }, "funding": [ { @@ -2078,32 +2201,35 @@ "type": "tidelift" } ], - "time": "2021-09-13T13:58:33+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/translation", - "version": "v6.0.5", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "e69501c71107cc3146b32aaa45f4edd0c3427875" + "reference": "637c51191b6b184184bbf98937702bcf554f7d04" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/e69501c71107cc3146b32aaa45f4edd0c3427875", - "reference": "e69501c71107cc3146b32aaa45f4edd0c3427875", + "url": "https://api.github.com/repos/symfony/translation/zipball/637c51191b6b184184bbf98937702bcf554f7d04", + "reference": "637c51191b6b184184bbf98937702bcf554f7d04", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/translation-contracts": "^2.3|^3.0" + "symfony/translation-contracts": "^2.5|^3.0" }, "conflict": { "symfony/config": "<5.4", "symfony/console": "<5.4", "symfony/dependency-injection": "<5.4", + "symfony/http-client-contracts": "<2.5", "symfony/http-kernel": "<5.4", + "symfony/service-contracts": "<2.5", "symfony/twig-bundle": "<5.4", "symfony/yaml": "<5.4" }, @@ -2111,22 +2237,19 @@ "symfony/translation-implementation": "2.3|3.0" }, "require-dev": { + "nikic/php-parser": "^4.18|^5.0", "psr/log": "^1|^2|^3", - "symfony/config": "^5.4|^6.0", - "symfony/console": "^5.4|^6.0", - "symfony/dependency-injection": "^5.4|^6.0", - "symfony/finder": "^5.4|^6.0", - "symfony/http-client-contracts": "^1.1|^2.0|^3.0", - "symfony/http-kernel": "^5.4|^6.0", - "symfony/intl": "^5.4|^6.0", + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/finder": "^5.4|^6.0|^7.0", + "symfony/http-client-contracts": "^2.5|^3.0", + "symfony/http-kernel": "^5.4|^6.0|^7.0", + "symfony/intl": "^5.4|^6.0|^7.0", "symfony/polyfill-intl-icu": "^1.21", - "symfony/service-contracts": "^1.1.2|^2|^3", - "symfony/yaml": "^5.4|^6.0" - }, - "suggest": { - "psr/log-implementation": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" + "symfony/routing": "^5.4|^6.0|^7.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/yaml": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -2157,7 +2280,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v6.0.5" + "source": "https://github.com/symfony/translation/tree/v6.4.3" }, "funding": [ { @@ -2173,32 +2296,29 @@ "type": "tidelift" } ], - "time": "2022-02-09T15:52:48+00:00" + "time": "2024-01-29T13:11:52+00:00" }, { "name": "symfony/translation-contracts", - "version": "v3.0.0", + "version": "v3.4.1", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "1b6ea5a7442af5a12dba3dbd6d71034b5b234e77" + "reference": "06450585bf65e978026bda220cdebca3f867fde7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/1b6ea5a7442af5a12dba3dbd6d71034b5b234e77", - "reference": "1b6ea5a7442af5a12dba3dbd6d71034b5b234e77", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/06450585bf65e978026bda220cdebca3f867fde7", + "reference": "06450585bf65e978026bda220cdebca3f867fde7", "shasum": "" }, "require": { - "php": ">=8.0.2" - }, - "suggest": { - "symfony/translation-implementation": "" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -2208,7 +2328,10 @@ "autoload": { "psr-4": { "Symfony\\Contracts\\Translation\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2235,7 +2358,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/translation-contracts/tree/v3.0.0" + "source": "https://github.com/symfony/translation-contracts/tree/v3.4.1" }, "funding": [ { @@ -2251,42 +2374,39 @@ "type": "tidelift" } ], - "time": "2021-09-07T12:43:40+00:00" + "time": "2023-12-26T14:02:43+00:00" }, { "name": "symfony/var-dumper", - "version": "v6.0.5", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "60d6a756d5f485df5e6e40b337334848f79f61ce" + "reference": "0435a08f69125535336177c29d56af3abc1f69da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/60d6a756d5f485df5e6e40b337334848f79f61ce", - "reference": "60d6a756d5f485df5e6e40b337334848f79f61ce", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/0435a08f69125535336177c29d56af3abc1f69da", + "reference": "0435a08f69125535336177c29d56af3abc1f69da", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "phpunit/phpunit": "<5.4.3", "symfony/console": "<5.4" }, "require-dev": { "ext-iconv": "*", - "symfony/console": "^5.4|^6.0", - "symfony/process": "^5.4|^6.0", - "symfony/uid": "^5.4|^6.0", + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/error-handler": "^6.3|^7.0", + "symfony/http-kernel": "^5.4|^6.0|^7.0", + "symfony/process": "^5.4|^6.0|^7.0", + "symfony/uid": "^5.4|^6.0|^7.0", "twig/twig": "^2.13|^3.0.4" }, - "suggest": { - "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", - "ext-intl": "To show region name in time zone dump", - "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" - }, "bin": [ "Resources/bin/var-dump-server" ], @@ -2323,7 +2443,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v6.0.5" + "source": "https://github.com/symfony/var-dumper/tree/v6.4.3" }, "funding": [ { @@ -2339,24 +2459,24 @@ "type": "tidelift" } ], - "time": "2022-02-21T17:15:17+00:00" + "time": "2024-01-23T14:53:30+00:00" }, { "name": "tightenco/collect", - "version": "v8.83.2", + "version": "v9.52.7", "source": { "type": "git", "url": "https://github.com/tighten/collect.git", - "reference": "d9c66d586ec2d216d8a31283d73f8df1400cc722" + "reference": "b15143cd11fe01a700fcc449df61adc64452fa6d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tighten/collect/zipball/d9c66d586ec2d216d8a31283d73f8df1400cc722", - "reference": "d9c66d586ec2d216d8a31283d73f8df1400cc722", + "url": "https://api.github.com/repos/tighten/collect/zipball/b15143cd11fe01a700fcc449df61adc64452fa6d", + "reference": "b15143cd11fe01a700fcc449df61adc64452fa6d", "shasum": "" }, "require": { - "php": "^7.3|^8.0", + "php": "^8.0", "symfony/var-dumper": "^3.4 || ^4.0 || ^5.0 || ^6.0" }, "require-dev": { @@ -2391,9 +2511,9 @@ ], "support": { "issues": "https://github.com/tighten/collect/issues", - "source": "https://github.com/tighten/collect/tree/v8.83.2" + "source": "https://github.com/tighten/collect/tree/v9.52.7" }, - "time": "2022-02-16T16:15:54+00:00" + "time": "2023-04-14T21:51:36+00:00" }, { "name": "twig/twig", @@ -2480,5 +2600,5 @@ "prefer-lowest": false, "platform": [], "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/data/web/inc/lib/vendor/autoload.php b/data/web/inc/lib/vendor/autoload.php index c21364e81..a0fb8f4ac 100644 --- a/data/web/inc/lib/vendor/autoload.php +++ b/data/web/inc/lib/vendor/autoload.php @@ -3,8 +3,21 @@ // autoload.php @generated by Composer if (PHP_VERSION_ID < 50600) { - echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; - exit(1); + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, $err); + } elseif (!headers_sent()) { + echo $err; + } + } + trigger_error( + $err, + E_USER_ERROR + ); } require_once __DIR__ . '/composer/autoload_real.php'; diff --git a/data/web/inc/lib/vendor/bin/carbon b/data/web/inc/lib/vendor/bin/carbon index 7b63379a0..86fbfdfd8 100755 --- a/data/web/inc/lib/vendor/bin/carbon +++ b/data/web/inc/lib/vendor/bin/carbon @@ -12,6 +12,7 @@ namespace Composer; +$GLOBALS['_composer_bin_dir'] = __DIR__; $GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php'; if (PHP_VERSION_ID < 80000) { @@ -23,18 +24,17 @@ if (PHP_VERSION_ID < 80000) { { private $handle; private $position; + private $realpath; public function stream_open($path, $mode, $options, &$opened_path) { - // get rid of composer-bin-proxy:// prefix for __FILE__ & __DIR__ resolution - $opened_path = substr($path, 21); - $opened_path = realpath($opened_path) ?: $opened_path; - $this->handle = fopen($opened_path, $mode); + // get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution + $opened_path = substr($path, 17); + $this->realpath = realpath($opened_path) ?: $opened_path; + $opened_path = $this->realpath; + $this->handle = fopen($this->realpath, $mode); $this->position = 0; - // remove all traces of this stream wrapper once it has been used - stream_wrapper_unregister('composer-bin-proxy'); - return (bool) $this->handle; } @@ -66,6 +66,16 @@ if (PHP_VERSION_ID < 80000) { return $operation ? flock($this->handle, $operation) : true; } + public function stream_seek($offset, $whence) + { + if (0 === fseek($this->handle, $offset, $whence)) { + $this->position = ftell($this->handle); + return true; + } + + return false; + } + public function stream_tell() { return $this->position; @@ -78,20 +88,32 @@ if (PHP_VERSION_ID < 80000) { public function stream_stat() { - return fstat($this->handle); + return array(); } public function stream_set_option($option, $arg1, $arg2) { return true; } + + public function url_stat($path, $flags) + { + $path = substr($path, 17); + if (file_exists($path)) { + return stat($path); + } + + return false; + } } } - if (function_exists('stream_wrapper_register') && stream_wrapper_register('composer-bin-proxy', 'Composer\BinProxyWrapper')) { - include("composer-bin-proxy://" . __DIR__ . '/..'.'/nesbot/carbon/bin/carbon'); - exit(0); + if ( + (function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true)) + || (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) + ) { + return include("phpvfscomposer://" . __DIR__ . '/..'.'/nesbot/carbon/bin/carbon'); } } -include __DIR__ . '/..'.'/nesbot/carbon/bin/carbon'; +return include __DIR__ . '/..'.'/nesbot/carbon/bin/carbon'; diff --git a/data/web/inc/lib/vendor/bin/var-dump-server b/data/web/inc/lib/vendor/bin/var-dump-server index 1eafd5d9b..18db1c1eb 100755 --- a/data/web/inc/lib/vendor/bin/var-dump-server +++ b/data/web/inc/lib/vendor/bin/var-dump-server @@ -12,6 +12,7 @@ namespace Composer; +$GLOBALS['_composer_bin_dir'] = __DIR__; $GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php'; if (PHP_VERSION_ID < 80000) { @@ -23,18 +24,17 @@ if (PHP_VERSION_ID < 80000) { { private $handle; private $position; + private $realpath; public function stream_open($path, $mode, $options, &$opened_path) { - // get rid of composer-bin-proxy:// prefix for __FILE__ & __DIR__ resolution - $opened_path = substr($path, 21); - $opened_path = realpath($opened_path) ?: $opened_path; - $this->handle = fopen($opened_path, $mode); + // get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution + $opened_path = substr($path, 17); + $this->realpath = realpath($opened_path) ?: $opened_path; + $opened_path = $this->realpath; + $this->handle = fopen($this->realpath, $mode); $this->position = 0; - // remove all traces of this stream wrapper once it has been used - stream_wrapper_unregister('composer-bin-proxy'); - return (bool) $this->handle; } @@ -66,6 +66,16 @@ if (PHP_VERSION_ID < 80000) { return $operation ? flock($this->handle, $operation) : true; } + public function stream_seek($offset, $whence) + { + if (0 === fseek($this->handle, $offset, $whence)) { + $this->position = ftell($this->handle); + return true; + } + + return false; + } + public function stream_tell() { return $this->position; @@ -78,20 +88,32 @@ if (PHP_VERSION_ID < 80000) { public function stream_stat() { - return fstat($this->handle); + return array(); } public function stream_set_option($option, $arg1, $arg2) { return true; } + + public function url_stat($path, $flags) + { + $path = substr($path, 17); + if (file_exists($path)) { + return stat($path); + } + + return false; + } } } - if (function_exists('stream_wrapper_register') && stream_wrapper_register('composer-bin-proxy', 'Composer\BinProxyWrapper')) { - include("composer-bin-proxy://" . __DIR__ . '/..'.'/symfony/var-dumper/Resources/bin/var-dump-server'); - exit(0); + if ( + (function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true)) + || (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper')) + ) { + return include("phpvfscomposer://" . __DIR__ . '/..'.'/symfony/var-dumper/Resources/bin/var-dump-server'); } } -include __DIR__ . '/..'.'/symfony/var-dumper/Resources/bin/var-dump-server'; +return include __DIR__ . '/..'.'/symfony/var-dumper/Resources/bin/var-dump-server'; diff --git a/data/web/inc/lib/vendor/carbonphp/carbon-doctrine-types/LICENSE b/data/web/inc/lib/vendor/carbonphp/carbon-doctrine-types/LICENSE new file mode 100644 index 000000000..2ee1671db --- /dev/null +++ b/data/web/inc/lib/vendor/carbonphp/carbon-doctrine-types/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Carbon + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/data/web/inc/lib/vendor/carbonphp/carbon-doctrine-types/README.md b/data/web/inc/lib/vendor/carbonphp/carbon-doctrine-types/README.md new file mode 100644 index 000000000..5a18121b6 --- /dev/null +++ b/data/web/inc/lib/vendor/carbonphp/carbon-doctrine-types/README.md @@ -0,0 +1,14 @@ +# carbonphp/carbon-doctrine-types + +Types to use Carbon in Doctrine + +## Documentation + +[Check how to use in the official Carbon documentation](https://carbon.nesbot.com/symfony/) + +This package is an externalization of [src/Carbon/Doctrine](https://github.com/briannesbitt/Carbon/tree/2.71.0/src/Carbon/Doctrine) +from `nestbot/carbon` package. + +Externalization allows to better deal with different versions of dbal. With +version 4.0 of dbal, it no longer sustainable to be compatible with all version +using a single code. diff --git a/data/web/inc/lib/vendor/carbonphp/carbon-doctrine-types/composer.json b/data/web/inc/lib/vendor/carbonphp/carbon-doctrine-types/composer.json new file mode 100644 index 000000000..abf45c5fb --- /dev/null +++ b/data/web/inc/lib/vendor/carbonphp/carbon-doctrine-types/composer.json @@ -0,0 +1,36 @@ +{ + "name": "carbonphp/carbon-doctrine-types", + "description": "Types to use Carbon in Doctrine", + "type": "library", + "keywords": [ + "date", + "time", + "DateTime", + "Carbon", + "Doctrine" + ], + "require": { + "php": "^8.1" + }, + "require-dev": { + "doctrine/dbal": "^4.0.0", + "nesbot/carbon": "^2.71.0 || ^3.0.0", + "phpunit/phpunit": "^10.3" + }, + "conflict": { + "doctrine/dbal": "<4.0.0 || >=5.0.0" + }, + "license": "MIT", + "autoload": { + "psr-4": { + "Carbon\\Doctrine\\": "src/Carbon/Doctrine/" + } + }, + "authors": [ + { + "name": "KyleKatarn", + "email": "kylekatarnls@gmail.com" + } + ], + "minimum-stability": "dev" +} diff --git a/data/web/inc/lib/vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/CarbonDoctrineType.php b/data/web/inc/lib/vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/CarbonDoctrineType.php new file mode 100644 index 000000000..a63a9b8d2 --- /dev/null +++ b/data/web/inc/lib/vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/CarbonDoctrineType.php @@ -0,0 +1,16 @@ + - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +declare(strict_types=1); namespace Carbon\Doctrine; @@ -15,7 +8,12 @@ use Carbon\Carbon; use Carbon\CarbonInterface; use DateTimeInterface; use Doctrine\DBAL\Platforms\AbstractPlatform; -use Doctrine\DBAL\Types\ConversionException; +use Doctrine\DBAL\Platforms\DB2Platform; +use Doctrine\DBAL\Platforms\OraclePlatform; +use Doctrine\DBAL\Platforms\SQLitePlatform; +use Doctrine\DBAL\Platforms\SQLServerPlatform; +use Doctrine\DBAL\Types\Exception\InvalidType; +use Doctrine\DBAL\Types\Exception\ValueNotConvertible; use Exception; /** @@ -23,6 +21,14 @@ use Exception; */ trait CarbonTypeConverter { + /** + * This property differentiates types installed by carbonphp/carbon-doctrine-types + * from the ones embedded previously in nesbot/carbon source directly. + * + * @readonly + */ + public bool $external = true; + /** * @return class-string */ @@ -31,20 +37,12 @@ trait CarbonTypeConverter return Carbon::class; } - /** - * @return string - */ - public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) + public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform): string { - $precision = $fieldDeclaration['precision'] ?: 10; - - if ($fieldDeclaration['secondPrecision'] ?? false) { - $precision = 0; - } - - if ($precision === 10) { - $precision = DateTimeDefaultPrecision::get(); - } + $precision = min( + $fieldDeclaration['precision'] ?? DateTimeDefaultPrecision::get(), + $this->getMaximumPrecision($platform), + ); $type = parent::getSQLDeclaration($fieldDeclaration, $platform); @@ -63,10 +61,25 @@ trait CarbonTypeConverter /** * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * @return T|null */ - public function convertToPHPValue($value, AbstractPlatform $platform) + public function convertToDatabaseValue($value, AbstractPlatform $platform): ?string + { + if ($value === null) { + return $value; + } + + if ($value instanceof DateTimeInterface) { + return $value->format('Y-m-d H:i:s.u'); + } + + throw InvalidType::new( + $value, + static::class, + ['null', 'DateTime', 'Carbon'] + ); + } + + private function doConvertToPHPValue(mixed $value) { $class = $this->getCarbonClassName(); @@ -88,9 +101,9 @@ trait CarbonTypeConverter } if (!$date) { - throw ConversionException::conversionFailedFormat( + throw ValueNotConvertible::new( $value, - $this->getName(), + static::class, 'Y-m-d H:i:s.u or any format supported by '.$class.'::parse()', $error ); @@ -99,25 +112,20 @@ trait CarbonTypeConverter return $date; } - /** - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * - * @return string|null - */ - public function convertToDatabaseValue($value, AbstractPlatform $platform) + private function getMaximumPrecision(AbstractPlatform $platform): int { - if ($value === null) { - return $value; + if ($platform instanceof DB2Platform) { + return 12; } - if ($value instanceof DateTimeInterface) { - return $value->format('Y-m-d H:i:s.u'); + if ($platform instanceof OraclePlatform) { + return 9; } - throw ConversionException::conversionFailedInvalidType( - $value, - $this->getName(), - ['null', 'DateTime', 'Carbon'] - ); + if ($platform instanceof SQLServerPlatform || $platform instanceof SQLitePlatform) { + return 3; + } + + return 6; } } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Doctrine/DateTimeDefaultPrecision.php b/data/web/inc/lib/vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/DateTimeDefaultPrecision.php similarity index 70% rename from data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Doctrine/DateTimeDefaultPrecision.php rename to data/web/inc/lib/vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/DateTimeDefaultPrecision.php index 642fd4135..cd9896f9c 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Doctrine/DateTimeDefaultPrecision.php +++ b/data/web/inc/lib/vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/DateTimeDefaultPrecision.php @@ -1,13 +1,6 @@ - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +declare(strict_types=1); namespace Carbon\Doctrine; diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Doctrine/DateTimeImmutableType.php b/data/web/inc/lib/vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/DateTimeImmutableType.php similarity index 58% rename from data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Doctrine/DateTimeImmutableType.php rename to data/web/inc/lib/vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/DateTimeImmutableType.php index 499271031..fd6467e3d 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Doctrine/DateTimeImmutableType.php +++ b/data/web/inc/lib/vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/DateTimeImmutableType.php @@ -1,12 +1,12 @@ */ use CarbonTypeConverter; + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function convertToPHPValue(mixed $value, AbstractPlatform $platform): ?CarbonImmutable + { + return $this->doConvertToPHPValue($value); + } + /** * @return class-string */ diff --git a/data/web/inc/lib/vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/DateTimeType.php b/data/web/inc/lib/vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/DateTimeType.php new file mode 100644 index 000000000..89e4b7903 --- /dev/null +++ b/data/web/inc/lib/vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/DateTimeType.php @@ -0,0 +1,24 @@ + */ + use CarbonTypeConverter; + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function convertToPHPValue(mixed $value, AbstractPlatform $platform): ?Carbon + { + return $this->doConvertToPHPValue($value); + } +} diff --git a/data/web/inc/lib/vendor/composer/ClassLoader.php b/data/web/inc/lib/vendor/composer/ClassLoader.php index afef3fa2a..7824d8f7e 100644 --- a/data/web/inc/lib/vendor/composer/ClassLoader.php +++ b/data/web/inc/lib/vendor/composer/ClassLoader.php @@ -42,35 +42,37 @@ namespace Composer\Autoload; */ class ClassLoader { - /** @var ?string */ + /** @var \Closure(string):void */ + private static $includeFile; + + /** @var string|null */ private $vendorDir; // PSR-4 /** - * @var array[] - * @psalm-var array> + * @var array> */ private $prefixLengthsPsr4 = array(); /** - * @var array[] - * @psalm-var array> + * @var array> */ private $prefixDirsPsr4 = array(); /** - * @var array[] - * @psalm-var array + * @var list */ private $fallbackDirsPsr4 = array(); // PSR-0 /** - * @var array[] - * @psalm-var array> + * List of PSR-0 prefixes + * + * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) + * + * @var array>> */ private $prefixesPsr0 = array(); /** - * @var array[] - * @psalm-var array + * @var list */ private $fallbackDirsPsr0 = array(); @@ -78,8 +80,7 @@ class ClassLoader private $useIncludePath = false; /** - * @var string[] - * @psalm-var array + * @var array */ private $classMap = array(); @@ -87,29 +88,29 @@ class ClassLoader private $classMapAuthoritative = false; /** - * @var bool[] - * @psalm-var array + * @var array */ private $missingClasses = array(); - /** @var ?string */ + /** @var string|null */ private $apcuPrefix; /** - * @var self[] + * @var array */ private static $registeredLoaders = array(); /** - * @param ?string $vendorDir + * @param string|null $vendorDir */ public function __construct($vendorDir = null) { $this->vendorDir = $vendorDir; + self::initializeIncludeClosure(); } /** - * @return string[] + * @return array> */ public function getPrefixes() { @@ -121,8 +122,7 @@ class ClassLoader } /** - * @return array[] - * @psalm-return array> + * @return array> */ public function getPrefixesPsr4() { @@ -130,8 +130,7 @@ class ClassLoader } /** - * @return array[] - * @psalm-return array + * @return list */ public function getFallbackDirs() { @@ -139,8 +138,7 @@ class ClassLoader } /** - * @return array[] - * @psalm-return array + * @return list */ public function getFallbackDirsPsr4() { @@ -148,8 +146,7 @@ class ClassLoader } /** - * @return string[] Array of classname => path - * @psalm-return array + * @return array Array of classname => path */ public function getClassMap() { @@ -157,8 +154,7 @@ class ClassLoader } /** - * @param string[] $classMap Class to filename map - * @psalm-param array $classMap + * @param array $classMap Class to filename map * * @return void */ @@ -175,24 +171,25 @@ class ClassLoader * Registers a set of PSR-0 directories for a given prefix, either * appending or prepending to the ones previously set for this prefix. * - * @param string $prefix The prefix - * @param string[]|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories * * @return void */ public function add($prefix, $paths, $prepend = false) { + $paths = (array) $paths; if (!$prefix) { if ($prepend) { $this->fallbackDirsPsr0 = array_merge( - (array) $paths, + $paths, $this->fallbackDirsPsr0 ); } else { $this->fallbackDirsPsr0 = array_merge( $this->fallbackDirsPsr0, - (array) $paths + $paths ); } @@ -201,19 +198,19 @@ class ClassLoader $first = $prefix[0]; if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = (array) $paths; + $this->prefixesPsr0[$first][$prefix] = $paths; return; } if ($prepend) { $this->prefixesPsr0[$first][$prefix] = array_merge( - (array) $paths, + $paths, $this->prefixesPsr0[$first][$prefix] ); } else { $this->prefixesPsr0[$first][$prefix] = array_merge( $this->prefixesPsr0[$first][$prefix], - (array) $paths + $paths ); } } @@ -222,9 +219,9 @@ class ClassLoader * Registers a set of PSR-4 directories for a given namespace, either * appending or prepending to the ones previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param string[]|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories * * @throws \InvalidArgumentException * @@ -232,17 +229,18 @@ class ClassLoader */ public function addPsr4($prefix, $paths, $prepend = false) { + $paths = (array) $paths; if (!$prefix) { // Register directories for the root namespace. if ($prepend) { $this->fallbackDirsPsr4 = array_merge( - (array) $paths, + $paths, $this->fallbackDirsPsr4 ); } else { $this->fallbackDirsPsr4 = array_merge( $this->fallbackDirsPsr4, - (array) $paths + $paths ); } } elseif (!isset($this->prefixDirsPsr4[$prefix])) { @@ -252,18 +250,18 @@ class ClassLoader throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); } $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; + $this->prefixDirsPsr4[$prefix] = $paths; } elseif ($prepend) { // Prepend directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( - (array) $paths, + $paths, $this->prefixDirsPsr4[$prefix] ); } else { // Append directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( $this->prefixDirsPsr4[$prefix], - (array) $paths + $paths ); } } @@ -272,8 +270,8 @@ class ClassLoader * Registers a set of PSR-0 directories for a given prefix, * replacing any others previously set for this prefix. * - * @param string $prefix The prefix - * @param string[]|string $paths The PSR-0 base directories + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 base directories * * @return void */ @@ -290,8 +288,8 @@ class ClassLoader * Registers a set of PSR-4 directories for a given namespace, * replacing any others previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param string[]|string $paths The PSR-4 base directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories * * @throws \InvalidArgumentException * @@ -425,7 +423,8 @@ class ClassLoader public function loadClass($class) { if ($file = $this->findFile($class)) { - includeFile($file); + $includeFile = self::$includeFile; + $includeFile($file); return true; } @@ -476,9 +475,9 @@ class ClassLoader } /** - * Returns the currently registered loaders indexed by their corresponding vendor directories. + * Returns the currently registered loaders keyed by their corresponding vendor directories. * - * @return self[] + * @return array */ public static function getRegisteredLoaders() { @@ -555,18 +554,26 @@ class ClassLoader return false; } -} -/** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - * - * @param string $file - * @return void - * @private - */ -function includeFile($file) -{ - include $file; + /** + * @return void + */ + private static function initializeIncludeClosure() + { + if (self::$includeFile !== null) { + return; + } + + /** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + */ + self::$includeFile = \Closure::bind(static function($file) { + include $file; + }, null, null); + } } diff --git a/data/web/inc/lib/vendor/composer/InstalledVersions.php b/data/web/inc/lib/vendor/composer/InstalledVersions.php index c6b54af7b..51e734a77 100644 --- a/data/web/inc/lib/vendor/composer/InstalledVersions.php +++ b/data/web/inc/lib/vendor/composer/InstalledVersions.php @@ -98,7 +98,7 @@ class InstalledVersions { foreach (self::getInstalled() as $installed) { if (isset($installed['versions'][$packageName])) { - return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); + return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; } } @@ -119,7 +119,7 @@ class InstalledVersions */ public static function satisfies(VersionParser $parser, $packageName, $constraint) { - $constraint = $parser->parseConstraints($constraint); + $constraint = $parser->parseConstraints((string) $constraint); $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); return $provided->matches($constraint); @@ -328,7 +328,9 @@ class InstalledVersions if (isset(self::$installedByVendor[$vendorDir])) { $installed[] = self::$installedByVendor[$vendorDir]; } elseif (is_file($vendorDir.'/composer/installed.php')) { - $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require $vendorDir.'/composer/installed.php'; + $installed[] = self::$installedByVendor[$vendorDir] = $required; if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { self::$installed = $installed[count($installed) - 1]; } @@ -340,12 +342,17 @@ class InstalledVersions // only require the installed.php file if this file is loaded from its dumped location, // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 if (substr(__DIR__, -8, 1) !== 'C') { - self::$installed = require __DIR__ . '/installed.php'; + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require __DIR__ . '/installed.php'; + self::$installed = $required; } else { self::$installed = array(); } } - $installed[] = self::$installed; + + if (self::$installed !== array()) { + $installed[] = self::$installed; + } return $installed; } diff --git a/data/web/inc/lib/vendor/composer/autoload_classmap.php b/data/web/inc/lib/vendor/composer/autoload_classmap.php index a986241bd..5490b88d8 100644 --- a/data/web/inc/lib/vendor/composer/autoload_classmap.php +++ b/data/web/inc/lib/vendor/composer/autoload_classmap.php @@ -8,6 +8,7 @@ $baseDir = dirname($vendorDir); return array( 'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php', 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', + 'PhpToken' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php', 'Stringable' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Stringable.php', 'UnhandledMatchError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php', 'ValueError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/ValueError.php', diff --git a/data/web/inc/lib/vendor/composer/autoload_files.php b/data/web/inc/lib/vendor/composer/autoload_files.php index 2730ec34b..bac0d960a 100644 --- a/data/web/inc/lib/vendor/composer/autoload_files.php +++ b/data/web/inc/lib/vendor/composer/autoload_files.php @@ -6,12 +6,12 @@ $vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( + '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', 'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php', - '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php', - '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php', 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php', + '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php', 'a1105708a18b76903365ca1c4aa61b02' => $vendorDir . '/symfony/translation/Resources/functions.php', '667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php', '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php', diff --git a/data/web/inc/lib/vendor/composer/autoload_psr4.php b/data/web/inc/lib/vendor/composer/autoload_psr4.php index 8e959eac3..9b7aef887 100644 --- a/data/web/inc/lib/vendor/composer/autoload_psr4.php +++ b/data/web/inc/lib/vendor/composer/autoload_psr4.php @@ -21,6 +21,7 @@ return array( 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'), 'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'), 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), + 'Psr\\Clock\\' => array($vendorDir . '/psr/clock/src'), 'PhpMimeMailParser\\' => array($vendorDir . '/php-mime-mail-parser/php-mime-mail-parser/src'), 'PHPMailer\\PHPMailer\\' => array($vendorDir . '/phpmailer/phpmailer/src'), 'MatthiasMullie\\PathConverter\\' => array($vendorDir . '/matthiasmullie/path-converter/src'), @@ -34,5 +35,6 @@ return array( 'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'), 'Firebase\\JWT\\' => array($vendorDir . '/firebase/php-jwt/src'), 'Ddeboer\\Imap\\' => array($vendorDir . '/ddeboer/imap/src'), + 'Carbon\\Doctrine\\' => array($vendorDir . '/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine'), 'Carbon\\' => array($vendorDir . '/nesbot/carbon/src/Carbon'), ); diff --git a/data/web/inc/lib/vendor/composer/autoload_real.php b/data/web/inc/lib/vendor/composer/autoload_real.php index 6891b0c9e..5e2082534 100644 --- a/data/web/inc/lib/vendor/composer/autoload_real.php +++ b/data/web/inc/lib/vendor/composer/autoload_real.php @@ -33,25 +33,18 @@ class ComposerAutoloaderInit873464e4bd965a3168f133248b1b218b $loader->register(true); - $includeFiles = \Composer\Autoload\ComposerStaticInit873464e4bd965a3168f133248b1b218b::$files; - foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire873464e4bd965a3168f133248b1b218b($fileIdentifier, $file); + $filesToLoad = \Composer\Autoload\ComposerStaticInit873464e4bd965a3168f133248b1b218b::$files; + $requireFile = \Closure::bind(static function ($fileIdentifier, $file) { + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + + require $file; + } + }, null, null); + foreach ($filesToLoad as $fileIdentifier => $file) { + $requireFile($fileIdentifier, $file); } return $loader; } } - -/** - * @param string $fileIdentifier - * @param string $file - * @return void - */ -function composerRequire873464e4bd965a3168f133248b1b218b($fileIdentifier, $file) -{ - if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { - $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; - - require $file; - } -} diff --git a/data/web/inc/lib/vendor/composer/autoload_static.php b/data/web/inc/lib/vendor/composer/autoload_static.php index 27a95eda8..7564e9725 100644 --- a/data/web/inc/lib/vendor/composer/autoload_static.php +++ b/data/web/inc/lib/vendor/composer/autoload_static.php @@ -7,12 +7,12 @@ namespace Composer\Autoload; class ComposerStaticInit873464e4bd965a3168f133248b1b218b { public static $files = array ( + '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', 'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php', - '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', - '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php', 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', + '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php', 'a1105708a18b76903365ca1c4aa61b02' => __DIR__ . '/..' . '/symfony/translation/Resources/functions.php', '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php', '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', @@ -48,6 +48,7 @@ class ComposerStaticInit873464e4bd965a3168f133248b1b218b 'Psr\\Http\\Message\\' => 17, 'Psr\\Http\\Client\\' => 16, 'Psr\\Container\\' => 14, + 'Psr\\Clock\\' => 10, 'PhpMimeMailParser\\' => 18, 'PHPMailer\\PHPMailer\\' => 20, ), @@ -85,6 +86,7 @@ class ComposerStaticInit873464e4bd965a3168f133248b1b218b ), 'C' => array ( + 'Carbon\\Doctrine\\' => 16, 'Carbon\\' => 7, ), ); @@ -151,6 +153,10 @@ class ComposerStaticInit873464e4bd965a3168f133248b1b218b array ( 0 => __DIR__ . '/..' . '/psr/container/src', ), + 'Psr\\Clock\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/clock/src', + ), 'PhpMimeMailParser\\' => array ( 0 => __DIR__ . '/..' . '/php-mime-mail-parser/php-mime-mail-parser/src', @@ -203,6 +209,10 @@ class ComposerStaticInit873464e4bd965a3168f133248b1b218b array ( 0 => __DIR__ . '/..' . '/ddeboer/imap/src', ), + 'Carbon\\Doctrine\\' => + array ( + 0 => __DIR__ . '/..' . '/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine', + ), 'Carbon\\' => array ( 0 => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon', @@ -222,6 +232,7 @@ class ComposerStaticInit873464e4bd965a3168f133248b1b218b public static $classMap = array ( 'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php', 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + 'PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php', 'Stringable' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Stringable.php', 'UnhandledMatchError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php', 'ValueError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/ValueError.php', diff --git a/data/web/inc/lib/vendor/composer/installed.json b/data/web/inc/lib/vendor/composer/installed.json index c5f82771a..a9a3966f5 100644 --- a/data/web/inc/lib/vendor/composer/installed.json +++ b/data/web/inc/lib/vendor/composer/installed.json @@ -61,6 +61,78 @@ ], "install-path": "../bshaffer/oauth2-server-php" }, + { + "name": "carbonphp/carbon-doctrine-types", + "version": "3.2.0", + "version_normalized": "3.2.0.0", + "source": { + "type": "git", + "url": "https://github.com/CarbonPHP/carbon-doctrine-types.git", + "reference": "18ba5ddfec8976260ead6e866180bd5d2f71aa1d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/CarbonPHP/carbon-doctrine-types/zipball/18ba5ddfec8976260ead6e866180bd5d2f71aa1d", + "reference": "18ba5ddfec8976260ead6e866180bd5d2f71aa1d", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "conflict": { + "doctrine/dbal": "<4.0.0 || >=5.0.0" + }, + "require-dev": { + "doctrine/dbal": "^4.0.0", + "nesbot/carbon": "^2.71.0 || ^3.0.0", + "phpunit/phpunit": "^10.3" + }, + "time": "2024-02-09T16:56:22+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Carbon\\Doctrine\\": "src/Carbon/Doctrine/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "KyleKatarn", + "email": "kylekatarnls@gmail.com" + } + ], + "description": "Types to use Carbon in Doctrine", + "keywords": [ + "carbon", + "date", + "datetime", + "doctrine", + "time" + ], + "support": { + "issues": "https://github.com/CarbonPHP/carbon-doctrine-types/issues", + "source": "https://github.com/CarbonPHP/carbon-doctrine-types/tree/3.2.0" + }, + "funding": [ + { + "url": "https://github.com/kylekatarnls", + "type": "github" + }, + { + "url": "https://opencollective.com/Carbon", + "type": "open_collective" + }, + { + "url": "https://tidelift.com/funding/github/packagist/nesbot/carbon", + "type": "tidelift" + } + ], + "install-path": "../carbonphp/carbon-doctrine-types" + }, { "name": "ddeboer/imap", "version": "1.13.1", @@ -141,35 +213,36 @@ }, { "name": "directorytree/ldaprecord", - "version": "v2.10.1", - "version_normalized": "2.10.1.0", + "version": "v2.20.5", + "version_normalized": "2.20.5.0", "source": { "type": "git", "url": "https://github.com/DirectoryTree/LdapRecord.git", - "reference": "bf512d9af7a7b0e2ed7a666ab29cefdd027bee88" + "reference": "5bd0a5a9d257cf1049ae83055dbba4c3479ddf16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DirectoryTree/LdapRecord/zipball/bf512d9af7a7b0e2ed7a666ab29cefdd027bee88", - "reference": "bf512d9af7a7b0e2ed7a666ab29cefdd027bee88", + "url": "https://api.github.com/repos/DirectoryTree/LdapRecord/zipball/5bd0a5a9d257cf1049ae83055dbba4c3479ddf16", + "reference": "5bd0a5a9d257cf1049ae83055dbba4c3479ddf16", "shasum": "" }, "require": { "ext-json": "*", "ext-ldap": "*", - "illuminate/contracts": "^5.0|^6.0|^7.0|^8.0|^9.0", + "illuminate/contracts": "^5.0|^6.0|^7.0|^8.0|^9.0|^10.0", "nesbot/carbon": "^1.0|^2.0", "php": ">=7.3", - "psr/log": "*", + "psr/log": "^1.0|^2.0|^3.0", "psr/simple-cache": "^1.0|^2.0", - "tightenco/collect": "^5.6|^6.0|^7.0|^8.0" + "symfony/polyfill-php80": "^1.25", + "tightenco/collect": "^5.6|^6.0|^7.0|^8.0|^9.0" }, "require-dev": { "mockery/mockery": "^1.0", "phpunit/phpunit": "^9.0", "spatie/ray": "^1.24" }, - "time": "2022-02-25T16:00:51+00:00", + "time": "2023-10-11T16:34:34+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -620,29 +693,29 @@ }, { "name": "illuminate/contracts", - "version": "v9.3.0", - "version_normalized": "9.3.0.0", + "version": "v10.44.0", + "version_normalized": "10.44.0.0", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", - "reference": "bf4b3c254c49d28157645d01e4883b5951b1e1d0" + "reference": "8d7152c4a1f5d9cf7da3e8b71f23e4556f6138ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/contracts/zipball/bf4b3c254c49d28157645d01e4883b5951b1e1d0", - "reference": "bf4b3c254c49d28157645d01e4883b5951b1e1d0", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/8d7152c4a1f5d9cf7da3e8b71f23e4556f6138ac", + "reference": "8d7152c4a1f5d9cf7da3e8b71f23e4556f6138ac", "shasum": "" }, "require": { - "php": "^8.0.2", + "php": "^8.1", "psr/container": "^1.1.1|^2.0.1", "psr/simple-cache": "^1.0|^2.0|^3.0" }, - "time": "2022-02-22T14:45:39+00:00", + "time": "2024-01-15T18:52:32+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "9.x-dev" + "dev-master": "10.x-dev" } }, "installation-source": "dist", @@ -930,38 +1003,45 @@ }, { "name": "nesbot/carbon", - "version": "2.57.0", - "version_normalized": "2.57.0.0", + "version": "2.72.3", + "version_normalized": "2.72.3.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "4a54375c21eea4811dbd1149fe6b246517554e78" + "reference": "0c6fd108360c562f6e4fd1dedb8233b423e91c83" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/4a54375c21eea4811dbd1149fe6b246517554e78", - "reference": "4a54375c21eea4811dbd1149fe6b246517554e78", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/0c6fd108360c562f6e4fd1dedb8233b423e91c83", + "reference": "0c6fd108360c562f6e4fd1dedb8233b423e91c83", "shasum": "" }, "require": { + "carbonphp/carbon-doctrine-types": "*", "ext-json": "*", "php": "^7.1.8 || ^8.0", + "psr/clock": "^1.0", "symfony/polyfill-mbstring": "^1.0", "symfony/polyfill-php80": "^1.16", "symfony/translation": "^3.4 || ^4.0 || ^5.0 || ^6.0" }, + "provide": { + "psr/clock-implementation": "1.0" + }, "require-dev": { - "doctrine/dbal": "^2.0 || ^3.0", - "doctrine/orm": "^2.7", + "doctrine/dbal": "^2.0 || ^3.1.4 || ^4.0", + "doctrine/orm": "^2.7 || ^3.0", "friendsofphp/php-cs-fixer": "^3.0", "kylekatarnls/multi-tester": "^2.0", + "ondrejmirtes/better-reflection": "*", "phpmd/phpmd": "^2.9", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^0.12.54 || ^1.0", - "phpunit/phpunit": "^7.5.20 || ^8.5.14", + "phpstan/phpstan": "^0.12.99 || ^1.7.14", + "phpunit/php-file-iterator": "^2.0.5 || ^3.0.6", + "phpunit/phpunit": "^7.5.20 || ^8.5.26 || ^9.5.20", "squizlabs/php_codesniffer": "^3.4" }, - "time": "2022-02-13T18:13:33+00:00", + "time": "2024-01-25T10:35:09+00:00", "bin": [ "bin/carbon" ], @@ -1017,11 +1097,15 @@ }, "funding": [ { - "url": "https://opencollective.com/Carbon", - "type": "open_collective" + "url": "https://github.com/sponsors/kylekatarnls", + "type": "github" }, { - "url": "https://tidelift.com/funding/github/packagist/nesbot/carbon", + "url": "https://opencollective.com/Carbon#sponsor", + "type": "opencollective" + }, + { + "url": "https://tidelift.com/subscription/pkg/packagist-nesbot-carbon?utm_source=packagist-nesbot-carbon&utm_medium=referral&utm_campaign=readme", "type": "tidelift" } ], @@ -1255,6 +1339,57 @@ ], "install-path": "../phpmailer/phpmailer" }, + { + "name": "psr/clock", + "version": "1.0.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "time": "2022-11-25T14:36:26+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "install-path": "../psr/clock" + }, { "name": "psr/container", "version": "2.0.2", @@ -1826,27 +1961,27 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v3.2.1", - "version_normalized": "3.2.1.0", + "version": "v3.4.0", + "version_normalized": "3.4.0.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e" + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", - "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", "shasum": "" }, "require": { "php": ">=8.1" }, - "time": "2023-03-01T10:25:55+00:00", + "time": "2023-05-23T14:45:45+00:00", "type": "library", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -1876,7 +2011,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.1" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.4.0" }, "funding": [ { @@ -1981,17 +2116,17 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.24.0", - "version_normalized": "1.24.0.0", + "version": "v1.29.0", + "version_normalized": "1.29.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", - "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", "shasum": "" }, "require": { @@ -2003,12 +2138,9 @@ "suggest": { "ext-mbstring": "For best performance" }, - "time": "2021-11-30T18:21:41+00:00", + "time": "2024-01-29T20:11:03+00:00", "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -2047,7 +2179,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" }, "funding": [ { @@ -2067,28 +2199,25 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.24.0", - "version_normalized": "1.24.0.0", + "version": "v1.29.0", + "version_normalized": "1.29.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9" + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/57b712b08eddb97c762a8caa32c84e037892d2e9", - "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", "shasum": "" }, "require": { "php": ">=7.1" }, - "time": "2021-09-13T13:58:33+00:00", + "time": "2024-01-29T20:11:03+00:00", "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -2133,7 +2262,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0" }, "funding": [ { @@ -2153,29 +2282,32 @@ }, { "name": "symfony/translation", - "version": "v6.0.5", - "version_normalized": "6.0.5.0", + "version": "v6.4.3", + "version_normalized": "6.4.3.0", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "e69501c71107cc3146b32aaa45f4edd0c3427875" + "reference": "637c51191b6b184184bbf98937702bcf554f7d04" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/e69501c71107cc3146b32aaa45f4edd0c3427875", - "reference": "e69501c71107cc3146b32aaa45f4edd0c3427875", + "url": "https://api.github.com/repos/symfony/translation/zipball/637c51191b6b184184bbf98937702bcf554f7d04", + "reference": "637c51191b6b184184bbf98937702bcf554f7d04", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/translation-contracts": "^2.3|^3.0" + "symfony/translation-contracts": "^2.5|^3.0" }, "conflict": { "symfony/config": "<5.4", "symfony/console": "<5.4", "symfony/dependency-injection": "<5.4", + "symfony/http-client-contracts": "<2.5", "symfony/http-kernel": "<5.4", + "symfony/service-contracts": "<2.5", "symfony/twig-bundle": "<5.4", "symfony/yaml": "<5.4" }, @@ -2183,24 +2315,21 @@ "symfony/translation-implementation": "2.3|3.0" }, "require-dev": { + "nikic/php-parser": "^4.18|^5.0", "psr/log": "^1|^2|^3", - "symfony/config": "^5.4|^6.0", - "symfony/console": "^5.4|^6.0", - "symfony/dependency-injection": "^5.4|^6.0", - "symfony/finder": "^5.4|^6.0", - "symfony/http-client-contracts": "^1.1|^2.0|^3.0", - "symfony/http-kernel": "^5.4|^6.0", - "symfony/intl": "^5.4|^6.0", + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/finder": "^5.4|^6.0|^7.0", + "symfony/http-client-contracts": "^2.5|^3.0", + "symfony/http-kernel": "^5.4|^6.0|^7.0", + "symfony/intl": "^5.4|^6.0|^7.0", "symfony/polyfill-intl-icu": "^1.21", - "symfony/service-contracts": "^1.1.2|^2|^3", - "symfony/yaml": "^5.4|^6.0" + "symfony/routing": "^5.4|^6.0|^7.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/yaml": "^5.4|^6.0|^7.0" }, - "suggest": { - "psr/log-implementation": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" - }, - "time": "2022-02-09T15:52:48+00:00", + "time": "2024-01-29T13:11:52+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -2231,7 +2360,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v6.0.5" + "source": "https://github.com/symfony/translation/tree/v6.4.3" }, "funding": [ { @@ -2251,30 +2380,27 @@ }, { "name": "symfony/translation-contracts", - "version": "v3.0.0", - "version_normalized": "3.0.0.0", + "version": "v3.4.1", + "version_normalized": "3.4.1.0", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "1b6ea5a7442af5a12dba3dbd6d71034b5b234e77" + "reference": "06450585bf65e978026bda220cdebca3f867fde7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/1b6ea5a7442af5a12dba3dbd6d71034b5b234e77", - "reference": "1b6ea5a7442af5a12dba3dbd6d71034b5b234e77", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/06450585bf65e978026bda220cdebca3f867fde7", + "reference": "06450585bf65e978026bda220cdebca3f867fde7", "shasum": "" }, "require": { - "php": ">=8.0.2" + "php": ">=8.1" }, - "suggest": { - "symfony/translation-implementation": "" - }, - "time": "2021-09-07T12:43:40+00:00", + "time": "2023-12-26T14:02:43+00:00", "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -2285,7 +2411,10 @@ "autoload": { "psr-4": { "Symfony\\Contracts\\Translation\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2312,7 +2441,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/translation-contracts/tree/v3.0.0" + "source": "https://github.com/symfony/translation-contracts/tree/v3.4.1" }, "funding": [ { @@ -2332,40 +2461,37 @@ }, { "name": "symfony/var-dumper", - "version": "v6.0.5", - "version_normalized": "6.0.5.0", + "version": "v6.4.3", + "version_normalized": "6.4.3.0", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "60d6a756d5f485df5e6e40b337334848f79f61ce" + "reference": "0435a08f69125535336177c29d56af3abc1f69da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/60d6a756d5f485df5e6e40b337334848f79f61ce", - "reference": "60d6a756d5f485df5e6e40b337334848f79f61ce", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/0435a08f69125535336177c29d56af3abc1f69da", + "reference": "0435a08f69125535336177c29d56af3abc1f69da", "shasum": "" }, "require": { - "php": ">=8.0.2", + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "phpunit/phpunit": "<5.4.3", "symfony/console": "<5.4" }, "require-dev": { "ext-iconv": "*", - "symfony/console": "^5.4|^6.0", - "symfony/process": "^5.4|^6.0", - "symfony/uid": "^5.4|^6.0", + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/error-handler": "^6.3|^7.0", + "symfony/http-kernel": "^5.4|^6.0|^7.0", + "symfony/process": "^5.4|^6.0|^7.0", + "symfony/uid": "^5.4|^6.0|^7.0", "twig/twig": "^2.13|^3.0.4" }, - "suggest": { - "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", - "ext-intl": "To show region name in time zone dump", - "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" - }, - "time": "2022-02-21T17:15:17+00:00", + "time": "2024-01-23T14:53:30+00:00", "bin": [ "Resources/bin/var-dump-server" ], @@ -2403,7 +2529,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v6.0.5" + "source": "https://github.com/symfony/var-dumper/tree/v6.4.3" }, "funding": [ { @@ -2423,21 +2549,21 @@ }, { "name": "tightenco/collect", - "version": "v8.83.2", - "version_normalized": "8.83.2.0", + "version": "v9.52.7", + "version_normalized": "9.52.7.0", "source": { "type": "git", "url": "https://github.com/tighten/collect.git", - "reference": "d9c66d586ec2d216d8a31283d73f8df1400cc722" + "reference": "b15143cd11fe01a700fcc449df61adc64452fa6d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tighten/collect/zipball/d9c66d586ec2d216d8a31283d73f8df1400cc722", - "reference": "d9c66d586ec2d216d8a31283d73f8df1400cc722", + "url": "https://api.github.com/repos/tighten/collect/zipball/b15143cd11fe01a700fcc449df61adc64452fa6d", + "reference": "b15143cd11fe01a700fcc449df61adc64452fa6d", "shasum": "" }, "require": { - "php": "^7.3|^8.0", + "php": "^8.0", "symfony/var-dumper": "^3.4 || ^4.0 || ^5.0 || ^6.0" }, "require-dev": { @@ -2445,7 +2571,7 @@ "nesbot/carbon": "^2.23.0", "phpunit/phpunit": "^8.3" }, - "time": "2022-02-16T16:15:54+00:00", + "time": "2023-04-14T21:51:36+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -2474,7 +2600,7 @@ ], "support": { "issues": "https://github.com/tighten/collect/issues", - "source": "https://github.com/tighten/collect/tree/v8.83.2" + "source": "https://github.com/tighten/collect/tree/v9.52.7" }, "install-path": "../tightenco/collect" }, diff --git a/data/web/inc/lib/vendor/composer/installed.php b/data/web/inc/lib/vendor/composer/installed.php index 0616e9a82..fed449fa2 100644 --- a/data/web/inc/lib/vendor/composer/installed.php +++ b/data/web/inc/lib/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => '__root__', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '96390c2e12fd8d886495fde5514ad431e4e66069', + 'reference' => '40146839efb3754b2db4045f0111178ffd1883c5', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,7 +13,7 @@ '__root__' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '96390c2e12fd8d886495fde5514ad431e4e66069', + 'reference' => '40146839efb3754b2db4045f0111178ffd1883c5', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -28,6 +28,15 @@ 'aliases' => array(), 'dev_requirement' => false, ), + 'carbonphp/carbon-doctrine-types' => array( + 'pretty_version' => '3.2.0', + 'version' => '3.2.0.0', + 'reference' => '18ba5ddfec8976260ead6e866180bd5d2f71aa1d', + 'type' => 'library', + 'install_path' => __DIR__ . '/../carbonphp/carbon-doctrine-types', + 'aliases' => array(), + 'dev_requirement' => false, + ), 'ddeboer/imap' => array( 'pretty_version' => '1.13.1', 'version' => '1.13.1.0', @@ -38,9 +47,9 @@ 'dev_requirement' => false, ), 'directorytree/ldaprecord' => array( - 'pretty_version' => 'v2.10.1', - 'version' => '2.10.1.0', - 'reference' => 'bf512d9af7a7b0e2ed7a666ab29cefdd027bee88', + 'pretty_version' => 'v2.20.5', + 'version' => '2.20.5.0', + 'reference' => '5bd0a5a9d257cf1049ae83055dbba4c3479ddf16', 'type' => 'library', 'install_path' => __DIR__ . '/../directorytree/ldaprecord', 'aliases' => array(), @@ -89,9 +98,9 @@ 'dev_requirement' => false, ), 'illuminate/contracts' => array( - 'pretty_version' => 'v9.3.0', - 'version' => '9.3.0.0', - 'reference' => 'bf4b3c254c49d28157645d01e4883b5951b1e1d0', + 'pretty_version' => 'v10.44.0', + 'version' => '10.44.0.0', + 'reference' => '8d7152c4a1f5d9cf7da3e8b71f23e4556f6138ac', 'type' => 'library', 'install_path' => __DIR__ . '/../illuminate/contracts', 'aliases' => array(), @@ -140,9 +149,9 @@ 'dev_requirement' => false, ), 'nesbot/carbon' => array( - 'pretty_version' => '2.57.0', - 'version' => '2.57.0.0', - 'reference' => '4a54375c21eea4811dbd1149fe6b246517554e78', + 'pretty_version' => '2.72.3', + 'version' => '2.72.3.0', + 'reference' => '0c6fd108360c562f6e4fd1dedb8233b423e91c83', 'type' => 'library', 'install_path' => __DIR__ . '/../nesbot/carbon', 'aliases' => array(), @@ -175,6 +184,21 @@ 'aliases' => array(), 'dev_requirement' => false, ), + 'psr/clock' => array( + 'pretty_version' => '1.0.0', + 'version' => '1.0.0.0', + 'reference' => 'e41a24703d4560fd0acb709162f73b8adfc3aa0d', + 'type' => 'library', + 'install_path' => __DIR__ . '/../psr/clock', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'psr/clock-implementation' => array( + 'dev_requirement' => false, + 'provided' => array( + 0 => '1.0', + ), + ), 'psr/container' => array( 'pretty_version' => '2.0.2', 'version' => '2.0.2.0', @@ -284,9 +308,9 @@ 'dev_requirement' => false, ), 'symfony/deprecation-contracts' => array( - 'pretty_version' => 'v3.2.1', - 'version' => '3.2.1.0', - 'reference' => 'e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e', + 'pretty_version' => 'v3.4.0', + 'version' => '3.4.0.0', + 'reference' => '7c3aff79d10325257a001fcf92d991f24fc967cf', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', 'aliases' => array(), @@ -302,36 +326,36 @@ 'dev_requirement' => false, ), 'symfony/polyfill-mbstring' => array( - 'pretty_version' => 'v1.24.0', - 'version' => '1.24.0.0', - 'reference' => '0abb51d2f102e00a4eefcf46ba7fec406d245825', + 'pretty_version' => 'v1.29.0', + 'version' => '1.29.0.0', + 'reference' => '9773676c8a1bb1f8d4340a62efe641cf76eda7ec', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-mbstring', 'aliases' => array(), 'dev_requirement' => false, ), 'symfony/polyfill-php80' => array( - 'pretty_version' => 'v1.24.0', - 'version' => '1.24.0.0', - 'reference' => '57b712b08eddb97c762a8caa32c84e037892d2e9', + 'pretty_version' => 'v1.29.0', + 'version' => '1.29.0.0', + 'reference' => '87b68208d5c1188808dd7839ee1e6c8ec3b02f1b', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-php80', 'aliases' => array(), 'dev_requirement' => false, ), 'symfony/translation' => array( - 'pretty_version' => 'v6.0.5', - 'version' => '6.0.5.0', - 'reference' => 'e69501c71107cc3146b32aaa45f4edd0c3427875', + 'pretty_version' => 'v6.4.3', + 'version' => '6.4.3.0', + 'reference' => '637c51191b6b184184bbf98937702bcf554f7d04', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/translation', 'aliases' => array(), 'dev_requirement' => false, ), 'symfony/translation-contracts' => array( - 'pretty_version' => 'v3.0.0', - 'version' => '3.0.0.0', - 'reference' => '1b6ea5a7442af5a12dba3dbd6d71034b5b234e77', + 'pretty_version' => 'v3.4.1', + 'version' => '3.4.1.0', + 'reference' => '06450585bf65e978026bda220cdebca3f867fde7', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/translation-contracts', 'aliases' => array(), @@ -344,18 +368,18 @@ ), ), 'symfony/var-dumper' => array( - 'pretty_version' => 'v6.0.5', - 'version' => '6.0.5.0', - 'reference' => '60d6a756d5f485df5e6e40b337334848f79f61ce', + 'pretty_version' => 'v6.4.3', + 'version' => '6.4.3.0', + 'reference' => '0435a08f69125535336177c29d56af3abc1f69da', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/var-dumper', 'aliases' => array(), 'dev_requirement' => false, ), 'tightenco/collect' => array( - 'pretty_version' => 'v8.83.2', - 'version' => '8.83.2.0', - 'reference' => 'd9c66d586ec2d216d8a31283d73f8df1400cc722', + 'pretty_version' => 'v9.52.7', + 'version' => '9.52.7.0', + 'reference' => 'b15143cd11fe01a700fcc449df61adc64452fa6d', 'type' => 'library', 'install_path' => __DIR__ . '/../tightenco/collect', 'aliases' => array(), diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/.github/ISSUE_TEMPLATE/bug_report.md b/data/web/inc/lib/vendor/directorytree/ldaprecord/.github/ISSUE_TEMPLATE/bug_report.md index a56a2afbc..4cbf18f9c 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/.github/ISSUE_TEMPLATE/bug_report.md +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/.github/ISSUE_TEMPLATE/bug_report.md @@ -7,7 +7,10 @@ assignees: '' --- - + **Environment:** - LDAP Server Type: [e.g. ActiveDirectory / OpenLDAP / FreeIPA] - PHP Version: [e.g. 7.3 / 7.4 / 8.0] diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/.github/ISSUE_TEMPLATE/support---help-request.md b/data/web/inc/lib/vendor/directorytree/ldaprecord/.github/ISSUE_TEMPLATE/support---help-request.md index 230916cf1..731d5cea0 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/.github/ISSUE_TEMPLATE/support---help-request.md +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/.github/ISSUE_TEMPLATE/support---help-request.md @@ -11,7 +11,10 @@ assignees: '' - + **Environment:** - LDAP Server Type: [e.g. ActiveDirectory / OpenLDAP / FreeIPA] - PHP Version: [e.g. 7.3 / 7.4 / 8.0] diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/.github/workflows/run-integration-tests.yml b/data/web/inc/lib/vendor/directorytree/ldaprecord/.github/workflows/run-integration-tests.yml new file mode 100644 index 000000000..6a6b2f9e5 --- /dev/null +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/.github/workflows/run-integration-tests.yml @@ -0,0 +1,62 @@ +name: run-integration-tests + +on: + push: + pull_request: + schedule: + - cron: "0 0 * * *" + +jobs: + run-tests: + runs-on: ${{ matrix.os }} + + services: + ldap: + image: osixia/openldap:1.4.0 + env: + LDAP_TLS_VERIFY_CLIENT: try + LDAP_OPENLDAP_UID: 1000 + LDAP_OPENLDAP_GID: 1000 + LDAP_ORGANISATION: Local + LDAP_DOMAIN: local.com + LDAP_ADMIN_PASSWORD: secret + ports: + - 389:389 + - 636:636 + + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + php: [8.1, 8.0, 7.4] + + name: ${{ matrix.os }} - P${{ matrix.php }} + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ~/.composer/cache/files + key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} + + - name: Set ldap.conf file permissions + run: sudo chown -R $USER:$USER /etc/ldap/ldap.conf + + - name: Create ldap.conf file disabling TLS verification + run: sudo echo "TLS_REQCERT never" > "/etc/ldap/ldap.conf" + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: ldap, json + coverage: none + + - name: Install dependencies + run: composer update --prefer-dist --no-interaction + + - name: Execute tests + run: vendor/bin/phpunit --testsuite Integration diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/.github/workflows/run-tests.yml b/data/web/inc/lib/vendor/directorytree/ldaprecord/.github/workflows/run-tests.yml index 44825dc20..6aaa3fd4a 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/.github/workflows/run-tests.yml +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/.github/workflows/run-tests.yml @@ -9,20 +9,20 @@ on: jobs: run-tests: runs-on: ${{ matrix.os }} + name: ${{ matrix.os }} - P${{ matrix.php }} + strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest] php: [8.1, 8.0, 7.4, 7.3] - name: ${{ matrix.os }} - P${{ matrix.php }} - steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v2 - name: Cache dependencies - uses: actions/cache@v3 + uses: actions/cache@v2 with: path: ~/.composer/cache/files key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} @@ -38,41 +38,4 @@ jobs: run: composer update --prefer-dist --no-interaction - name: Execute tests - run: vendor/bin/phpunit - - run-analysis: - runs-on: ${{ matrix.os }} - name: Static code analysis (PHP ${{ matrix.php }}) - - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - php: [8.0] - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Cache dependencies - uses: actions/cache@v3 - with: - path: ~/.composer/cache/files - key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - extensions: ldap, json - coverage: none - tools: psalm - - - name: Validate composer.json - run: composer validate - - - name: Install dependencies - run: composer update --prefer-dist --no-interaction - - - name: Run Psalm - run: psalm + run: vendor/bin/phpunit --testsuite Unit diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/.styleci.yml b/data/web/inc/lib/vendor/directorytree/ldaprecord/.styleci.yml index 9f5e38cfa..0285f1790 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/.styleci.yml +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/.styleci.yml @@ -1,8 +1 @@ preset: laravel -enabled: - - phpdoc_align - - phpdoc_separation - - unalign_double_arrow -disabled: - - laravel_phpdoc_alignment - - laravel_phpdoc_separation diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/composer.json b/data/web/inc/lib/vendor/directorytree/ldaprecord/composer.json index 35c605766..65d7dd8f6 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/composer.json +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/composer.json @@ -32,11 +32,12 @@ "php": ">=7.3", "ext-ldap": "*", "ext-json": "*", - "psr/log": "*", + "psr/log": "^1.0|^2.0|^3.0", "psr/simple-cache": "^1.0|^2.0", "nesbot/carbon": "^1.0|^2.0", - "tightenco/collect": "^5.6|^6.0|^7.0|^8.0", - "illuminate/contracts": "^5.0|^6.0|^7.0|^8.0|^9.0" + "tightenco/collect": "^5.6|^6.0|^7.0|^8.0|^9.0", + "illuminate/contracts": "^5.0|^6.0|^7.0|^8.0|^9.0|^10.0", + "symfony/polyfill-php80": "^1.25" }, "require-dev": { "phpunit/phpunit": "^9.0", diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/docker-compose.yml b/data/web/inc/lib/vendor/directorytree/ldaprecord/docker-compose.yml new file mode 100644 index 000000000..de96b1398 --- /dev/null +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/docker-compose.yml @@ -0,0 +1,35 @@ +version: '3' + +services: + ldap: + image: osixia/openldap:1.4.0 + container_name: ldap + restart: always + hostname: local.com + environment: + LDAP_TLS_VERIFY_CLIENT: try + LDAP_OPENLDAP_UID: 1000 + LDAP_OPENLDAP_GID: 1000 + LDAP_ORGANISATION: Local + LDAP_DOMAIN : local.com + LDAP_ADMIN_PASSWORD: secret + ports: + - "389:389" + - "636:636" + networks: + - local + + ldapadmin: + image: osixia/phpldapadmin:0.9.0 + container_name: ldapadmin + environment: + PHPLDAPADMIN_LDAP_HOSTS: ldap + restart: always + ports: + - "6443:443" + networks: + - local + +networks: + local: + driver: bridge diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/phpunit.xml b/data/web/inc/lib/vendor/directorytree/ldaprecord/phpunit.xml index d03fdc20e..aed09e4d6 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/phpunit.xml +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/phpunit.xml @@ -10,8 +10,11 @@ stopOnFailure="false" > - - ./tests/ + + ./tests/Unit + + + ./tests/Integration diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/psalm.xml b/data/web/inc/lib/vendor/directorytree/ldaprecord/psalm.xml deleted file mode 100644 index 7c0333df3..000000000 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/psalm.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/readme.md b/data/web/inc/lib/vendor/directorytree/ldaprecord/readme.md index 505d6992c..e00f8ef69 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/readme.md +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/readme.md @@ -6,7 +6,7 @@

- + @@ -45,7 +45,7 @@ ⏲ **Up and Running Fast** -Connect to your LDAP servers and start running queries at lightning speed. +Connect to your LDAP servers and start running queries in a matter of minutes. 💡 **Fluent Filter Builder** diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Auth/Events/Event.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Auth/Events/Event.php index 83716b422..7c1bb3c87 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Auth/Events/Event.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Auth/Events/Event.php @@ -30,9 +30,9 @@ abstract class Event /** * Constructor. * - * @param LdapInterface $connection - * @param string $username - * @param string $password + * @param LdapInterface $connection + * @param string $username + * @param string $password */ public function __construct(LdapInterface $connection, $username, $password) { diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Auth/Guard.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Auth/Guard.php index d41af1569..c00989ae6 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Auth/Guard.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Auth/Guard.php @@ -38,8 +38,8 @@ class Guard /** * Constructor. * - * @param LdapInterface $connection - * @param DomainConfiguration $configuration + * @param LdapInterface $connection + * @param DomainConfiguration $configuration */ public function __construct(LdapInterface $connection, DomainConfiguration $configuration) { @@ -50,10 +50,9 @@ class Guard /** * Attempt binding a user to the LDAP server. * - * @param string $username - * @param string $password - * @param bool $stayBound - * + * @param string $username + * @param string $password + * @param bool $stayBound * @return bool * * @throws UsernameRequiredException @@ -90,8 +89,8 @@ class Guard /** * Attempt binding a user to the LDAP server. Supports anonymous binding. * - * @param string|null $username - * @param string|null $password + * @param string|null $username + * @param string|null $password * * @throws BindException * @throws \LdapRecord\ConnectionException @@ -148,8 +147,7 @@ class Guard /** * Set the event dispatcher instance. * - * @param DispatcherInterface $dispatcher - * + * @param DispatcherInterface $dispatcher * @return void */ public function setDispatcher(DispatcherInterface $dispatcher) @@ -160,9 +158,8 @@ class Guard /** * Fire the attempting event. * - * @param string $username - * @param string $password - * + * @param string $username + * @param string $password * @return void */ protected function fireAttemptingEvent($username, $password) @@ -175,9 +172,8 @@ class Guard /** * Fire the passed event. * - * @param string $username - * @param string $password - * + * @param string $username + * @param string $password * @return void */ protected function firePassedEvent($username, $password) @@ -190,9 +186,8 @@ class Guard /** * Fire the failed event. * - * @param string $username - * @param string $password - * + * @param string $username + * @param string $password * @return void */ protected function fireFailedEvent($username, $password) @@ -205,9 +200,8 @@ class Guard /** * Fire the binding event. * - * @param string $username - * @param string $password - * + * @param string $username + * @param string $password * @return void */ protected function fireBindingEvent($username, $password) @@ -220,9 +214,8 @@ class Guard /** * Fire the bound event. * - * @param string $username - * @param string $password - * + * @param string $username + * @param string $password * @return void */ protected function fireBoundEvent($username, $password) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Configuration/DomainConfiguration.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Configuration/DomainConfiguration.php index d1124bfc9..f71f63d87 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Configuration/DomainConfiguration.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Configuration/DomainConfiguration.php @@ -58,7 +58,7 @@ class DomainConfiguration /** * Constructor. * - * @param array $options + * @param array $options * * @throws ConfigurationException When an option value given is an invalid type. */ @@ -74,9 +74,8 @@ class DomainConfiguration /** * Extend the configuration with a custom option, or override an existing. * - * @param string $option - * @param mixed $default - * + * @param string $option + * @param mixed $default * @return void */ public static function extend($option, $default = null) @@ -107,8 +106,8 @@ class DomainConfiguration /** * Set a configuration option. * - * @param string $key - * @param mixed $value + * @param string $key + * @param mixed $value * * @throws ConfigurationException When an option value given is an invalid type. */ @@ -122,8 +121,7 @@ class DomainConfiguration /** * Returns the value for the specified configuration options. * - * @param string $key - * + * @param string $key * @return mixed * * @throws ConfigurationException When the option specified does not exist. @@ -140,8 +138,7 @@ class DomainConfiguration /** * Checks if a configuration option exists. * - * @param string $key - * + * @param string $key * @return bool */ public function has($key) @@ -152,9 +149,8 @@ class DomainConfiguration /** * Validate the configuration option. * - * @param string $key - * @param mixed $value - * + * @param string $key + * @param mixed $value * @return bool * * @throws ConfigurationException When an option value given is an invalid type. diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Configuration/Validators/Validator.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Configuration/Validators/Validator.php index de2f13f56..d107314d5 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Configuration/Validators/Validator.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Configuration/Validators/Validator.php @@ -30,8 +30,8 @@ abstract class Validator /** * Constructor. * - * @param string $key - * @param mixed $value + * @param string $key + * @param mixed $value */ public function __construct($key, $value) { diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Connection.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Connection.php index d429aa462..6e55cffc9 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Connection.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Connection.php @@ -88,8 +88,8 @@ class Connection /** * Constructor. * - * @param array $config - * @param LdapInterface|null $ldap + * @param array|DomainConfiguration $config + * @param LdapInterface|null $ldap */ public function __construct($config = [], LdapInterface $ldap = null) { @@ -109,15 +109,18 @@ class Connection /** * Set the connection configuration. * - * @param array $config - * + * @param array|DomainConfiguration $config * @return $this * * @throws Configuration\ConfigurationException */ public function setConfiguration($config = []) { - $this->configuration = new DomainConfiguration($config); + if (! $config instanceof DomainConfiguration) { + $config = new DomainConfiguration($config); + } + + $this->configuration = $config; $this->hosts = $this->configuration->get('hosts'); @@ -129,8 +132,7 @@ class Connection /** * Set the LDAP connection. * - * @param LdapInterface $ldap - * + * @param LdapInterface $ldap * @return $this */ public function setLdapConnection(LdapInterface $ldap) @@ -143,8 +145,7 @@ class Connection /** * Set the event dispatcher. * - * @param DispatcherInterface $dispatcher - * + * @param DispatcherInterface $dispatcher * @return $this */ public function setDispatcher(DispatcherInterface $dispatcher) @@ -192,8 +193,7 @@ class Connection /** * Set the cache store. * - * @param CacheInterface $store - * + * @param CacheInterface $store * @return $this */ public function setCache(CacheInterface $store) @@ -238,9 +238,8 @@ class Connection * * If no username or password is specified, then the configured credentials are used. * - * @param string|null $username - * @param string|null $password - * + * @param string|null $username + * @param string|null $password * @return Connection * * @throws Auth\BindException @@ -298,6 +297,16 @@ class Connection $this->initialize(); } + /** + * Clone the connection. + * + * @return static + */ + public function replicate() + { + return new static($this->configuration, new $this->ldap); + } + /** * Disconnect from the LDAP server. * @@ -311,8 +320,7 @@ class Connection /** * Dispatch an event. * - * @param object $event - * + * @param object $event * @return void */ public function dispatch($event) @@ -335,8 +343,7 @@ class Connection /** * Perform the operation on the LDAP connection. * - * @param Closure $operation - * + * @param Closure $operation * @return mixed */ public function run(Closure $operation) @@ -359,11 +366,27 @@ class Connection } } + /** + * Perform the operation on an isolated LDAP connection. + * + * @param Closure $operation + * @return mixed + */ + public function isolate(Closure $operation) + { + $connection = $this->replicate(); + + try { + return $operation($connection); + } finally { + $connection->disconnect(); + } + } + /** * Attempt to get an exception for the cause of failure. * - * @param LdapRecordException $e - * + * @param LdapRecordException $e * @return mixed */ protected function getExceptionForCauseOfFailure(LdapRecordException $e) @@ -383,8 +406,7 @@ class Connection /** * Run the operation callback on the current LDAP connection. * - * @param Closure $operation - * + * @param Closure $operation * @return mixed * * @throws LdapRecordException @@ -439,9 +461,8 @@ class Connection /** * Attempt to retry an LDAP operation if due to a lost connection. * - * @param LdapRecordException $e - * @param Closure $operation - * + * @param LdapRecordException $e + * @param Closure $operation * @return mixed * * @throws LdapRecordException @@ -461,8 +482,7 @@ class Connection /** * Retry the operation on the current host. * - * @param Closure $operation - * + * @param Closure $operation * @return mixed * * @throws LdapRecordException @@ -483,9 +503,8 @@ class Connection /** * Attempt the operation again on the next host. * - * @param LdapRecordException $e - * @param Closure $operation - * + * @param LdapRecordException $e + * @param Closure $operation * @return mixed * * @throws LdapRecordException diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/ConnectionManager.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/ConnectionManager.php index 01b072b4e..0597f1f68 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/ConnectionManager.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/ConnectionManager.php @@ -81,9 +81,8 @@ class ConnectionManager /** * Forward missing method calls onto the instance. * - * @param string $method - * @param mixed $args - * + * @param string $method + * @param mixed $args * @return mixed */ public function __call($method, $args) @@ -104,9 +103,8 @@ class ConnectionManager /** * Add a new connection. * - * @param Connection $connection - * @param string|null $name - * + * @param Connection $connection + * @param string|null $name * @return $this */ public function add(Connection $connection, $name = null) @@ -123,8 +121,7 @@ class ConnectionManager /** * Remove a connection. * - * @param $name - * + * @param $name * @return $this */ public function remove($name) @@ -147,8 +144,7 @@ class ConnectionManager /** * Get a connection by name or return the default. * - * @param string|null $name - * + * @param string|null $name * @return Connection * * @throws ContainerException If the given connection does not exist. @@ -185,8 +181,7 @@ class ConnectionManager /** * Checks if the connection exists. * - * @param string $name - * + * @param string $name * @return bool */ public function exists($name) @@ -197,8 +192,7 @@ class ConnectionManager /** * Set the default connection name. * - * @param string $name - * + * @param string $name * @return $this */ public function setDefault($name = null) @@ -237,8 +231,7 @@ class ConnectionManager /** * Set the event logger to use. * - * @param LoggerInterface $logger - * + * @param LoggerInterface $logger * @return void */ public function setLogger(LoggerInterface $logger) @@ -299,8 +292,7 @@ class ConnectionManager /** * Set the event dispatcher. * - * @param DispatcherInterface $dispatcher - * + * @param DispatcherInterface $dispatcher * @return void */ public function setDispatcher(DispatcherInterface $dispatcher) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Container.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Container.php index f458951e7..0c125593d 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Container.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Container.php @@ -48,9 +48,8 @@ class Container /** * Forward missing static calls onto the current instance. * - * @param string $method - * @param mixed $args - * + * @param string $method + * @param mixed $args * @return mixed */ public static function __callStatic($method, $args) @@ -71,8 +70,7 @@ class Container /** * Set the container instance. * - * @param Container|null $container - * + * @param Container|null $container * @return Container|null */ public static function setInstance(self $container = null) @@ -103,9 +101,8 @@ class Container /** * Forward missing method calls onto the connection manager. * - * @param string $method - * @param mixed $args - * + * @param string $method + * @param mixed $args * @return mixed */ public function __call($method, $args) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/DetailedError.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/DetailedError.php index d61159ed3..fff528c98 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/DetailedError.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/DetailedError.php @@ -28,9 +28,9 @@ class DetailedError /** * Constructor. * - * @param int $errorCode - * @param string $errorMessage - * @param string $diagnosticMessage + * @param int $errorCode + * @param string $errorMessage + * @param string $diagnosticMessage */ public function __construct($errorCode, $errorMessage, $diagnosticMessage) { diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/DetectsErrors.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/DetectsErrors.php index e8997a931..61fc4a02e 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/DetectsErrors.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/DetectsErrors.php @@ -7,8 +7,7 @@ trait DetectsErrors /** * Determine if the error was caused by a lost connection. * - * @param string $error - * + * @param string $error * @return bool */ protected function causedByLostConnection($error) @@ -19,8 +18,7 @@ trait DetectsErrors /** * Determine if the error was caused by lack of pagination support. * - * @param string $error - * + * @param string $error * @return bool */ protected function causedByPaginationSupport($error) @@ -31,8 +29,7 @@ trait DetectsErrors /** * Determine if the error was caused by a size limit warning. * - * @param $error - * + * @param $error * @return bool */ protected function causedBySizeLimit($error) @@ -43,8 +40,7 @@ trait DetectsErrors /** * Determine if the error was caused by a "No such object" warning. * - * @param string $error - * + * @param string $error * @return bool */ protected function causedByNoSuchObject($error) @@ -55,15 +51,14 @@ trait DetectsErrors /** * Determine if the error contains the any of the messages. * - * @param string $error - * @param string|array $messages - * + * @param string $error + * @param string|array $messages * @return bool */ protected function errorContainsMessage($error, $messages = []) { foreach ((array) $messages as $message) { - if (strpos($error, $message) !== false) { + if (str_contains((string) $error, $message)) { return true; } } diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/EscapesValues.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/EscapesValues.php index acfc020bf..ea53a2f93 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/EscapesValues.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/EscapesValues.php @@ -9,10 +9,9 @@ trait EscapesValues /** * Prepare a value to be escaped. * - * @param string $value - * @param string $ignore - * @param int $flags - * + * @param string $value + * @param string $ignore + * @param int $flags * @return EscapedValue */ public function escape($value, $ignore = '', $flags = 0) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Events/ConnectionEvent.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Events/ConnectionEvent.php index e9c2c352c..d2d77e2fc 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Events/ConnectionEvent.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Events/ConnectionEvent.php @@ -16,7 +16,7 @@ abstract class ConnectionEvent /** * Constructor. * - * @param Connection $connection + * @param Connection $connection */ public function __construct(Connection $connection) { diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Events/Dispatcher.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Events/Dispatcher.php index a4ae3def0..4fedbc2ef 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Events/Dispatcher.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Events/Dispatcher.php @@ -46,7 +46,7 @@ class Dispatcher implements DispatcherInterface public function listen($events, $listener) { foreach ((array) $events as $event) { - if (strpos($event, '*') !== false) { + if (str_contains((string) $event, '*')) { $this->setupWildcardListen($event, $listener); } else { $this->listeners[$event][] = $this->makeListener($listener); @@ -57,9 +57,8 @@ class Dispatcher implements DispatcherInterface /** * Setup a wildcard listener callback. * - * @param string $event - * @param mixed $listener - * + * @param string $event + * @param mixed $listener * @return void */ protected function setupWildcardListen($event, $listener) @@ -134,9 +133,8 @@ class Dispatcher implements DispatcherInterface /** * Parse the given event and payload and prepare them for dispatching. * - * @param mixed $event - * @param mixed $payload - * + * @param mixed $event + * @param mixed $payload * @return array */ protected function parseEventAndPayload($event, $payload) @@ -168,8 +166,7 @@ class Dispatcher implements DispatcherInterface /** * Get the wildcard listeners for the event. * - * @param string $eventName - * + * @param string $eventName * @return array */ protected function getWildcardListeners($eventName) @@ -190,9 +187,8 @@ class Dispatcher implements DispatcherInterface * * This function is a direct excerpt from Laravel's Str::is(). * - * @param string $wildcard - * @param string $eventName - * + * @param string $wildcard + * @param string $eventName * @return bool */ protected function wildcardContainsEvent($wildcard, $eventName) @@ -229,9 +225,8 @@ class Dispatcher implements DispatcherInterface /** * Add the listeners for the event's interfaces to the given array. * - * @param string $eventName - * @param array $listeners - * + * @param string $eventName + * @param array $listeners * @return array */ protected function addInterfaceListeners($eventName, array $listeners = []) @@ -250,9 +245,8 @@ class Dispatcher implements DispatcherInterface /** * Register an event listener with the dispatcher. * - * @param \Closure|string $listener - * @param bool $wildcard - * + * @param \Closure|string $listener + * @param bool $wildcard * @return \Closure */ public function makeListener($listener, $wildcard = false) @@ -273,9 +267,8 @@ class Dispatcher implements DispatcherInterface /** * Create a class based listener. * - * @param string $listener - * @param bool $wildcard - * + * @param string $listener + * @param bool $wildcard * @return \Closure */ protected function createClassListener($listener, $wildcard = false) @@ -295,8 +288,7 @@ class Dispatcher implements DispatcherInterface /** * Create the class based event callable. * - * @param string $listener - * + * @param string $listener * @return callable */ protected function createClassCallable($listener) @@ -309,13 +301,12 @@ class Dispatcher implements DispatcherInterface /** * Parse the class listener into class and method. * - * @param string $listener - * + * @param string $listener * @return array */ protected function parseListenerCallback($listener) { - return strpos($listener, '@') !== false + return str_contains((string) $listener, '@') ? explode('@', $listener, 2) : [$listener, 'handle']; } @@ -325,7 +316,7 @@ class Dispatcher implements DispatcherInterface */ public function forget($event) { - if (strpos($event, '*') !== false) { + if (str_contains((string) $event, '*')) { unset($this->wildcards[$event]); } else { unset($this->listeners[$event]); diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Events/DispatcherInterface.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Events/DispatcherInterface.php index 6b7cb10c6..590328f09 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Events/DispatcherInterface.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Events/DispatcherInterface.php @@ -7,9 +7,8 @@ interface DispatcherInterface /** * Register an event listener with the dispatcher. * - * @param string|array $events - * @param mixed $listener - * + * @param string|array $events + * @param mixed $listener * @return void */ public function listen($events, $listener); @@ -17,8 +16,7 @@ interface DispatcherInterface /** * Determine if a given event has listeners. * - * @param string $eventName - * + * @param string $eventName * @return bool */ public function hasListeners($eventName); @@ -26,9 +24,8 @@ interface DispatcherInterface /** * Fire an event until the first non-null response is returned. * - * @param string|object $event - * @param mixed $payload - * + * @param string|object $event + * @param mixed $payload * @return array|null */ public function until($event, $payload = []); @@ -36,10 +33,9 @@ interface DispatcherInterface /** * Fire an event and call the listeners. * - * @param string|object $event - * @param mixed $payload - * @param bool $halt - * + * @param string|object $event + * @param mixed $payload + * @param bool $halt * @return mixed */ public function fire($event, $payload = [], $halt = false); @@ -47,10 +43,9 @@ interface DispatcherInterface /** * Fire an event and call the listeners. * - * @param string|object $event - * @param mixed $payload - * @param bool $halt - * + * @param string|object $event + * @param mixed $payload + * @param bool $halt * @return array|null */ public function dispatch($event, $payload = [], $halt = false); @@ -58,8 +53,7 @@ interface DispatcherInterface /** * Get all of the listeners for a given event name. * - * @param string $eventName - * + * @param string $eventName * @return array */ public function getListeners($eventName); @@ -67,8 +61,7 @@ interface DispatcherInterface /** * Remove a set of listeners from the dispatcher. * - * @param string $event - * + * @param string $event * @return void */ public function forget($event); diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Events/Logger.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Events/Logger.php index b2082e596..b8a849169 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Events/Logger.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Events/Logger.php @@ -21,7 +21,7 @@ class Logger /** * Constructor. * - * @param LoggerInterface|null $logger + * @param LoggerInterface|null $logger */ public function __construct(LoggerInterface $logger = null) { @@ -31,8 +31,7 @@ class Logger /** * Logs the given event. * - * @param mixed $event - * + * @param mixed $event * @return void */ public function log($event) @@ -53,8 +52,7 @@ class Logger /** * Logs an authentication event. * - * @param AuthEvent $event - * + * @param AuthEvent $event * @return void */ public function auth(AuthEvent $event) @@ -81,8 +79,7 @@ class Logger /** * Logs a model event. * - * @param ModelEvent $event - * + * @param ModelEvent $event * @return void */ public function model(ModelEvent $event) @@ -106,8 +103,7 @@ class Logger /** * Logs a query event. * - * @param QueryEvent $event - * + * @param QueryEvent $event * @return void */ public function query(QueryEvent $event) @@ -133,8 +129,7 @@ class Logger /** * Returns the operational name of the given event. * - * @param mixed $event - * + * @param mixed $event * @return string */ protected function getOperationName($event) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Events/NullDispatcher.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Events/NullDispatcher.php index 73b1f5a8e..7683d1f80 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Events/NullDispatcher.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Events/NullDispatcher.php @@ -14,7 +14,7 @@ class NullDispatcher implements DispatcherInterface /** * Constructor. * - * @param DispatcherInterface $dispatcher + * @param DispatcherInterface $dispatcher */ public function __construct(DispatcherInterface $dispatcher) { @@ -24,9 +24,8 @@ class NullDispatcher implements DispatcherInterface /** * Register an event listener with the dispatcher. * - * @param string|array $events - * @param mixed $listener - * + * @param string|array $events + * @param mixed $listener * @return void */ public function listen($events, $listener) @@ -37,8 +36,7 @@ class NullDispatcher implements DispatcherInterface /** * Determine if a given event has listeners. * - * @param string $eventName - * + * @param string $eventName * @return bool */ public function hasListeners($eventName) @@ -49,9 +47,8 @@ class NullDispatcher implements DispatcherInterface /** * Fire an event until the first non-null response is returned. * - * @param string|object $event - * @param mixed $payload - * + * @param string|object $event + * @param mixed $payload * @return null */ public function until($event, $payload = []) @@ -62,10 +59,9 @@ class NullDispatcher implements DispatcherInterface /** * Fire an event and call the listeners. * - * @param string|object $event - * @param mixed $payload - * @param bool $halt - * + * @param string|object $event + * @param mixed $payload + * @param bool $halt * @return null */ public function fire($event, $payload = [], $halt = false) @@ -76,10 +72,9 @@ class NullDispatcher implements DispatcherInterface /** * Fire an event and call the listeners. * - * @param string|object $event - * @param mixed $payload - * @param bool $halt - * + * @param string|object $event + * @param mixed $payload + * @param bool $halt * @return null */ public function dispatch($event, $payload = [], $halt = false) @@ -90,8 +85,7 @@ class NullDispatcher implements DispatcherInterface /** * Get all of the listeners for a given event name. * - * @param string $eventName - * + * @param string $eventName * @return array */ public function getListeners($eventName) @@ -102,8 +96,7 @@ class NullDispatcher implements DispatcherInterface /** * Remove a set of listeners from the dispatcher. * - * @param string $event - * + * @param string $event * @return void */ public function forget($event) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/HandlesConnection.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/HandlesConnection.php index 9af7ad751..4a2e27598 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/HandlesConnection.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/HandlesConnection.php @@ -148,8 +148,7 @@ trait HandlesConnection /** * Convert warnings to exceptions for the given operation. * - * @param Closure $operation - * + * @param Closure $operation * @return mixed * * @throws LdapRecordException @@ -190,8 +189,7 @@ trait HandlesConnection /** * Determine if the failed operation should be bypassed. * - * @param string $method - * + * @param string $method * @return bool */ protected function shouldBypassFailure($method) @@ -202,8 +200,7 @@ trait HandlesConnection /** * Determine if the error should be bypassed. * - * @param string $error - * + * @param string $error * @return bool */ protected function shouldBypassError($error) @@ -226,9 +223,8 @@ trait HandlesConnection /** * Generates an LDAP connection string for each host given. * - * @param string|array $hosts - * @param string $port - * + * @param string|array $hosts + * @param string $port * @return string */ protected function makeConnectionUris($hosts, $port) @@ -249,9 +245,8 @@ trait HandlesConnection /** * Assemble the host URI strings. * - * @param array|string $hosts - * @param string $port - * + * @param array|string $hosts + * @param string $port * @return array */ protected function assembleHostUris($hosts, $port) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Ldap.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Ldap.php index 0c3574f13..76c372040 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Ldap.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Ldap.php @@ -4,7 +4,6 @@ namespace LdapRecord; use LDAP\Connection as RawLdapConnection; -/** @psalm-suppress UndefinedClass */ class Ldap implements LdapInterface { use HandlesConnection, DetectsErrors; @@ -24,8 +23,7 @@ class Ldap implements LdapInterface * * @see http://php.net/manual/en/function.ldap-first-entry.php * - * @param resource $searchResults - * + * @param resource $searchResults * @return resource */ public function getFirstEntry($searchResults) @@ -40,8 +38,7 @@ class Ldap implements LdapInterface * * @see http://php.net/manual/en/function.ldap-next-entry.php * - * @param resource $entry - * + * @param resource $entry * @return resource */ public function getNextEntry($entry) @@ -56,8 +53,7 @@ class Ldap implements LdapInterface * * @see http://php.net/manual/en/function.ldap-get-attributes.php * - * @param resource $entry - * + * @param resource $entry * @return array|false */ public function getAttributes($entry) @@ -72,8 +68,7 @@ class Ldap implements LdapInterface * * @see http://php.net/manual/en/function.ldap-count-entries.php * - * @param resource $searchResults - * + * @param resource $searchResults * @return int */ public function countEntries($searchResults) @@ -88,10 +83,9 @@ class Ldap implements LdapInterface * * @see http://php.net/manual/en/function.ldap-compare.php * - * @param string $dn - * @param string $attribute - * @param string $value - * + * @param string $dn + * @param string $attribute + * @param string $value * @return mixed */ public function compare($dn, $attribute, $value) @@ -132,9 +126,8 @@ class Ldap implements LdapInterface * * @see http://php.net/manual/en/function.ldap-get-values-len.php * - * @param $entry - * @param $attribute - * + * @param $entry + * @param $attribute * @return array */ public function getValuesLen($entry, $attribute) @@ -167,8 +160,7 @@ class Ldap implements LdapInterface * * @see http://php.net/manual/en/function.ldap-set-rebind-proc.php * - * @param callable $callback - * + * @param callable $callback * @return bool */ public function setRebindCallback(callable $callback) @@ -304,7 +296,7 @@ class Ldap implements LdapInterface public function bind($username, $password) { return $this->bound = $this->executeFailableOperation(function () use ($username, $password) { - return ldap_bind($this->connection, $username, html_entity_decode($password)); + return ldap_bind($this->connection, $username, $password ? html_entity_decode($password) : null); }); } @@ -462,8 +454,7 @@ class Ldap implements LdapInterface /** * Extract the diagnostic code from the message. * - * @param string $message - * + * @param string $message * @return string|bool */ public function extractDiagnosticCode($message) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/LdapInterface.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/LdapInterface.php index c74fe4e89..fcff57f48 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/LdapInterface.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/LdapInterface.php @@ -9,28 +9,28 @@ interface LdapInterface * * @var string */ - const PROTOCOL_SSL = 'ldaps://'; + public const PROTOCOL_SSL = 'ldaps://'; /** * The standard LDAP protocol string. * * @var string */ - const PROTOCOL = 'ldap://'; + public const PROTOCOL = 'ldap://'; /** * The LDAP SSL port number. * * @var string */ - const PORT_SSL = 636; + public const PORT_SSL = 636; /** * The standard LDAP port number. * * @var string */ - const PORT = 389; + public const PORT = 389; /** * Various useful server control OID's. @@ -38,37 +38,36 @@ interface LdapInterface * @see https://ldap.com/ldap-oid-reference-guide/ * @see http://msdn.microsoft.com/en-us/library/cc223359.aspx */ - const OID_SERVER_START_TLS = '1.3.6.1.4.1.1466.20037'; - const OID_SERVER_PAGED_RESULTS = '1.2.840.113556.1.4.319'; - const OID_SERVER_SHOW_DELETED = '1.2.840.113556.1.4.417'; - const OID_SERVER_SORT = '1.2.840.113556.1.4.473'; - const OID_SERVER_CROSSDOM_MOVE_TARGET = '1.2.840.113556.1.4.521'; - const OID_SERVER_NOTIFICATION = '1.2.840.113556.1.4.528'; - const OID_SERVER_EXTENDED_DN = '1.2.840.113556.1.4.529'; - const OID_SERVER_LAZY_COMMIT = '1.2.840.113556.1.4.619'; - const OID_SERVER_SD_FLAGS = '1.2.840.113556.1.4.801'; - const OID_SERVER_TREE_DELETE = '1.2.840.113556.1.4.805'; - const OID_SERVER_DIRSYNC = '1.2.840.113556.1.4.841'; - const OID_SERVER_VERIFY_NAME = '1.2.840.113556.1.4.1338'; - const OID_SERVER_DOMAIN_SCOPE = '1.2.840.113556.1.4.1339'; - const OID_SERVER_SEARCH_OPTIONS = '1.2.840.113556.1.4.1340'; - const OID_SERVER_PERMISSIVE_MODIFY = '1.2.840.113556.1.4.1413'; - const OID_SERVER_ASQ = '1.2.840.113556.1.4.1504'; - const OID_SERVER_FAST_BIND = '1.2.840.113556.1.4.1781'; - const OID_SERVER_CONTROL_VLVREQUEST = '2.16.840.1.113730.3.4.9'; + public const OID_SERVER_START_TLS = '1.3.6.1.4.1.1466.20037'; + public const OID_SERVER_PAGED_RESULTS = '1.2.840.113556.1.4.319'; + public const OID_SERVER_SHOW_DELETED = '1.2.840.113556.1.4.417'; + public const OID_SERVER_SORT = '1.2.840.113556.1.4.473'; + public const OID_SERVER_CROSSDOM_MOVE_TARGET = '1.2.840.113556.1.4.521'; + public const OID_SERVER_NOTIFICATION = '1.2.840.113556.1.4.528'; + public const OID_SERVER_EXTENDED_DN = '1.2.840.113556.1.4.529'; + public const OID_SERVER_LAZY_COMMIT = '1.2.840.113556.1.4.619'; + public const OID_SERVER_SD_FLAGS = '1.2.840.113556.1.4.801'; + public const OID_SERVER_TREE_DELETE = '1.2.840.113556.1.4.805'; + public const OID_SERVER_DIRSYNC = '1.2.840.113556.1.4.841'; + public const OID_SERVER_VERIFY_NAME = '1.2.840.113556.1.4.1338'; + public const OID_SERVER_DOMAIN_SCOPE = '1.2.840.113556.1.4.1339'; + public const OID_SERVER_SEARCH_OPTIONS = '1.2.840.113556.1.4.1340'; + public const OID_SERVER_PERMISSIVE_MODIFY = '1.2.840.113556.1.4.1413'; + public const OID_SERVER_ASQ = '1.2.840.113556.1.4.1504'; + public const OID_SERVER_FAST_BIND = '1.2.840.113556.1.4.1781'; + public const OID_SERVER_CONTROL_VLVREQUEST = '2.16.840.1.113730.3.4.9'; /** * Query OID's. * * @see https://ldapwiki.com/wiki/LDAP_MATCHING_RULE_IN_CHAIN */ - const OID_MATCHING_RULE_IN_CHAIN = '1.2.840.113556.1.4.1941'; + public const OID_MATCHING_RULE_IN_CHAIN = '1.2.840.113556.1.4.1941'; /** * Set the current connection to use SSL. * - * @param bool $enabled - * + * @param bool $enabled * @return $this */ public function ssl(); @@ -83,8 +82,7 @@ interface LdapInterface /** * Set the current connection to use TLS. * - * @param bool $enabled - * + * @param bool $enabled * @return $this */ public function tls(); @@ -138,8 +136,7 @@ interface LdapInterface * * @see http://php.net/manual/en/function.ldap-get-entries.php * - * @param resource $searchResults - * + * @param resource $searchResults * @return array */ public function getEntries($searchResults); @@ -169,9 +166,8 @@ interface LdapInterface * * @see http://php.net/manual/en/function.ldap-set-option.php * - * @param int $option - * @param mixed $value - * + * @param int $option + * @param mixed $value * @return bool */ public function setOption($option, $value); @@ -179,8 +175,7 @@ interface LdapInterface /** * Set options on the current connection. * - * @param array $options - * + * @param array $options * @return void */ public function setOptions(array $options = []); @@ -190,9 +185,8 @@ interface LdapInterface * * @see https://www.php.net/manual/en/function.ldap-get-option.php * - * @param int $option - * @param mixed $value - * + * @param int $option + * @param mixed $value * @return mixed */ public function getOption($option, &$value = null); @@ -213,9 +207,8 @@ interface LdapInterface * * @see http://php.net/manual/en/function.ldap-start-tls.php * - * @param string|array $hosts - * @param int $port - * + * @param string|array $hosts + * @param int $port * @return resource|false */ public function connect($hosts = [], $port = 389); @@ -236,15 +229,14 @@ interface LdapInterface * * @see http://php.net/manual/en/function.ldap-search.php * - * @param string $dn - * @param string $filter - * @param array $fields - * @param bool $onlyAttributes - * @param int $size - * @param int $time - * @param int $deref - * @param array $serverControls - * + * @param string $dn + * @param string $filter + * @param array $fields + * @param bool $onlyAttributes + * @param int $size + * @param int $time + * @param int $deref + * @param array $serverControls * @return resource */ public function search($dn, $filter, array $fields, $onlyAttributes = false, $size = 0, $time = 0, $deref = LDAP_DEREF_NEVER, $serverControls = []); @@ -254,15 +246,14 @@ interface LdapInterface * * @see http://php.net/manual/en/function.ldap-list.php * - * @param string $dn - * @param string $filter - * @param array $fields - * @param bool $onlyAttributes - * @param int $size - * @param int $time - * @param int $deref - * @param array $serverControls - * + * @param string $dn + * @param string $filter + * @param array $fields + * @param bool $onlyAttributes + * @param int $size + * @param int $time + * @param int $deref + * @param array $serverControls * @return resource */ public function listing($dn, $filter, array $fields, $onlyAttributes = false, $size = 0, $time = 0, $deref = LDAP_DEREF_NEVER, $serverControls = []); @@ -272,15 +263,14 @@ interface LdapInterface * * @see http://php.net/manual/en/function.ldap-read.php * - * @param string $dn - * @param string $filter - * @param array $fields - * @param bool $onlyAttributes - * @param int $size - * @param int $time - * @param int $deref - * @param array $serverControls - * + * @param string $dn + * @param string $filter + * @param array $fields + * @param bool $onlyAttributes + * @param int $size + * @param int $time + * @param int $deref + * @param array $serverControls * @return resource */ public function read($dn, $filter, array $fields, $onlyAttributes = false, $size = 0, $time = 0, $deref = LDAP_DEREF_NEVER, $serverControls = []); @@ -290,13 +280,12 @@ interface LdapInterface * * @see https://www.php.net/manual/en/function.ldap-parse-result.php * - * @param resource $result - * @param int $errorCode - * @param ?string $dn - * @param ?string $errorMessage - * @param ?array $referrals - * @param ?array $serverControls - * + * @param resource $result + * @param int $errorCode + * @param ?string $dn + * @param ?string $errorMessage + * @param ?array $referrals + * @param ?array $serverControls * @return bool */ public function parseResult($result, &$errorCode, &$dn, &$errorMessage, &$referrals, &$serverControls = []); @@ -307,9 +296,8 @@ interface LdapInterface * * @see http://php.net/manual/en/function.ldap-bind.php * - * @param string $username - * @param string $password - * + * @param string $username + * @param string $password * @return bool * * @throws LdapRecordException @@ -321,9 +309,8 @@ interface LdapInterface * * @see http://php.net/manual/en/function.ldap-add.php * - * @param string $dn - * @param array $entry - * + * @param string $dn + * @param array $entry * @return bool * * @throws LdapRecordException @@ -335,8 +322,7 @@ interface LdapInterface * * @see http://php.net/manual/en/function.ldap-delete.php * - * @param string $dn - * + * @param string $dn * @return bool * * @throws LdapRecordException @@ -348,11 +334,10 @@ interface LdapInterface * * @see http://php.net/manual/en/function.ldap-rename.php * - * @param string $dn - * @param string $newRdn - * @param string $newParent - * @param bool $deleteOldRdn - * + * @param string $dn + * @param string $newRdn + * @param string $newParent + * @param bool $deleteOldRdn * @return bool * * @throws LdapRecordException @@ -364,9 +349,8 @@ interface LdapInterface * * @see http://php.net/manual/en/function.ldap-modify.php * - * @param string $dn - * @param array $entry - * + * @param string $dn + * @param array $entry * @return bool * * @throws LdapRecordException @@ -378,9 +362,8 @@ interface LdapInterface * * @see http://php.net/manual/en/function.ldap-modify-batch.php * - * @param string $dn - * @param array $values - * + * @param string $dn + * @param array $values * @return bool * * @throws LdapRecordException @@ -392,9 +375,8 @@ interface LdapInterface * * @see http://php.net/manual/en/function.ldap-mod-add.php * - * @param string $dn - * @param array $entry - * + * @param string $dn + * @param array $entry * @return bool * * @throws LdapRecordException @@ -406,9 +388,8 @@ interface LdapInterface * * @see http://php.net/manual/en/function.ldap-mod-replace.php * - * @param string $dn - * @param array $entry - * + * @param string $dn + * @param array $entry * @return bool * * @throws LdapRecordException @@ -420,9 +401,8 @@ interface LdapInterface * * @see http://php.net/manual/en/function.ldap-mod-del.php * - * @param string $dn - * @param array $entry - * + * @param string $dn + * @param array $entry * @return bool * * @throws LdapRecordException @@ -434,10 +414,9 @@ interface LdapInterface * * @see http://php.net/manual/en/function.ldap-control-paged-result.php * - * @param int $pageSize - * @param bool $isCritical - * @param string $cookie - * + * @param int $pageSize + * @param bool $isCritical + * @param string $cookie * @return bool */ public function controlPagedResult($pageSize = 1000, $isCritical = false, $cookie = ''); @@ -447,9 +426,8 @@ interface LdapInterface * * @see http://php.net/manual/en/function.ldap-control-paged-result-response.php * - * @param resource $result - * @param string $cookie - * + * @param resource $result + * @param string $cookie * @return bool */ public function controlPagedResultResponse($result, &$cookie); @@ -459,8 +437,7 @@ interface LdapInterface * * @see https://www.php.net/manual/en/function.ldap-free-result.php * - * @param resource $result - * + * @param resource $result * @return bool */ public function freeResult($result); @@ -479,8 +456,7 @@ interface LdapInterface * * @see http://php.net/manual/en/function.ldap-err2str.php * - * @param int $number - * + * @param int $number * @return string */ public function err2Str($number); diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/LdapRecordException.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/LdapRecordException.php index b2439bf83..0669b4c65 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/LdapRecordException.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/LdapRecordException.php @@ -16,9 +16,8 @@ class LdapRecordException extends Exception /** * Create a new Bind Exception with a detailed connection error. * - * @param Exception $e - * @param DetailedError|null $error - * + * @param Exception $e + * @param DetailedError|null $error * @return $this */ public static function withDetailedError(Exception $e, DetailedError $error = null) @@ -29,8 +28,7 @@ class LdapRecordException extends Exception /** * Set the detailed error. * - * @param DetailedError|null $error - * + * @param DetailedError|null $error * @return $this */ public function setDetailedError(DetailedError $error = null) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/Concerns/HasPrimaryGroup.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/Concerns/HasPrimaryGroup.php index 97fd3a1fb..b7138d30c 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/Concerns/HasPrimaryGroup.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/Concerns/HasPrimaryGroup.php @@ -9,10 +9,9 @@ trait HasPrimaryGroup /** * Returns a new has one primary group relationship. * - * @param mixed $related - * @param string $relationKey - * @param string $foreignKey - * + * @param mixed $related + * @param string $relationKey + * @param string $foreignKey * @return HasOnePrimaryGroup */ public function hasOnePrimaryGroup($related, $relationKey, $foreignKey = 'primarygroupid') diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/Entry.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/Entry.php index 652ad563f..e1a0233cc 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/Entry.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/Entry.php @@ -9,6 +9,7 @@ use LdapRecord\Models\Entry as BaseEntry; use LdapRecord\Models\Events\Updated; use LdapRecord\Models\Types\ActiveDirectory; use LdapRecord\Query\Model\ActiveDirectoryBuilder; +use LdapRecord\Support\Arr; /** @mixin ActiveDirectoryBuilder */ class Entry extends BaseEntry implements ActiveDirectory @@ -50,20 +51,46 @@ class Entry extends BaseEntry implements ActiveDirectory /** * @inheritdoc */ - public function getConvertedSid() + public function getConvertedSid($sid = null) { try { - return (string) new Sid($this->getObjectSid()); + return (string) $this->newObjectSid( + $sid ?? $this->getObjectSid() + ); } catch (InvalidArgumentException $e) { return; } } + /** + * @inheritdoc + */ + public function getBinarySid($sid = null) + { + try { + return $this->newObjectSid( + $sid ?? $this->getObjectSid() + )->getBinary(); + } catch (InvalidArgumentException $e) { + return; + } + } + + /** + * Make a new object Sid instance. + * + * @param string $value + * @return Sid + */ + protected function newObjectSid($value) + { + return new Sid($value); + } + /** * Create a new query builder. * - * @param Connection $connection - * + * @param Connection $connection * @return ActiveDirectoryBuilder */ public function newQueryBuilder(Connection $connection) @@ -84,8 +111,7 @@ class Entry extends BaseEntry implements ActiveDirectory /** * Restore a deleted object. * - * @param string|null $newParentDn - * + * @param string|null $newParentDn * @return bool * * @throws \LdapRecord\LdapRecordException @@ -114,24 +140,6 @@ class Entry extends BaseEntry implements ActiveDirectory $this->save(['isDeleted' => null]); } - /** - * Get the RootDSE (AD schema) record from the directory. - * - * @param string|null $connection - * - * @return static - * - * @throws \LdapRecord\Models\ModelNotFoundException - */ - public static function getRootDse($connection = null) - { - return static::on($connection ?? (new static())->getConnectionName()) - ->in(null) - ->read() - ->whereHas('objectclass') - ->firstOrFail(); - } - /** * Get the objects restore location. * @@ -143,22 +151,50 @@ class Entry extends BaseEntry implements ActiveDirectory } /** - * Converts attributes for JSON serialization. - * - * @param array $attributes + * Convert the attributes for JSON serialization. * + * @param array $attributes * @return array */ protected function convertAttributesForJson(array $attributes = []) { $attributes = parent::convertAttributesForJson($attributes); - if ($this->hasAttribute($this->sidKey)) { - // If the model has a SID set, we need to convert it due to it being in - // binary. Otherwise we will receive a JSON serialization exception. - return array_replace($attributes, [ - $this->sidKey => [$this->getConvertedSid()], - ]); + // If the model has a SID set, we need to convert it to its + // string format, due to it being in binary. Otherwise + // we will receive a JSON serialization exception. + if (isset($attributes[$this->sidKey])) { + $attributes[$this->sidKey] = [$this->getConvertedSid( + Arr::first($attributes[$this->sidKey]) + )]; + } + + return $attributes; + } + + /** + * Convert the attributes from JSON serialization. + * + * @param array $attributes + * @return array + */ + protected function convertAttributesFromJson(array $attributes = []) + { + $attributes = parent::convertAttributesFromJson($attributes); + + // Here we are converting the model's GUID and SID attributes + // back to their original values from serialization, so that + // their original value may be used and compared against. + if (isset($attributes[$this->guidKey])) { + $attributes[$this->guidKey] = [$this->getBinaryGuid( + Arr::first($attributes[$this->guidKey]) + )]; + } + + if (isset($attributes[$this->sidKey])) { + $attributes[$this->sidKey] = [$this->getBinarySid( + Arr::first($attributes[$this->sidKey]) + )]; } return $attributes; diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/Relations/HasOnePrimaryGroup.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/Relations/HasOnePrimaryGroup.php index 540ec7717..40350c97a 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/Relations/HasOnePrimaryGroup.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/Relations/HasOnePrimaryGroup.php @@ -10,8 +10,7 @@ class HasOnePrimaryGroup extends HasOne /** * Get the foreign model by the given value. * - * @param string $value - * + * @param string $value * @return Model|null */ protected function getForeignModelByValue($value) @@ -26,8 +25,7 @@ class HasOnePrimaryGroup extends HasOne * * Retrieves the last RID from the models Object SID. * - * @param Model $model - * + * @param Model $model * @return string */ protected function getForeignValueFromModel(Model $model) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/Scopes/HasServerRoleAttribute.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/Scopes/HasServerRoleAttribute.php index cd08648da..76df79ca3 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/Scopes/HasServerRoleAttribute.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/Scopes/HasServerRoleAttribute.php @@ -11,9 +11,8 @@ class HasServerRoleAttribute implements Scope /** * Includes condition of having a serverRole attribute. * - * @param Builder $query - * @param Model $model - * + * @param Builder $query + * @param Model $model * @return void */ public function apply(Builder $query, Model $model) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/Scopes/InConfigurationContext.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/Scopes/InConfigurationContext.php index 9f2fbe4d7..dc8a4d21b 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/Scopes/InConfigurationContext.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/Scopes/InConfigurationContext.php @@ -12,9 +12,8 @@ class InConfigurationContext implements Scope /** * Refines the base dn to be inside the configuration context. * - * @param Builder $query - * @param Model $model - * + * @param Builder $query + * @param Model $model * @return void * * @throws \LdapRecord\Models\ModelNotFoundException @@ -27,8 +26,7 @@ class InConfigurationContext implements Scope /** * Get the LDAP server configuration naming context distinguished name. * - * @param Model $model - * + * @param Model $model * @return mixed * * @throws \LdapRecord\Models\ModelNotFoundException diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/Scopes/RejectComputerObjectClass.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/Scopes/RejectComputerObjectClass.php index a616db1c0..9d00cf8fa 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/Scopes/RejectComputerObjectClass.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/Scopes/RejectComputerObjectClass.php @@ -11,9 +11,8 @@ class RejectComputerObjectClass implements Scope /** * Prevent computer objects from being included in results. * - * @param Builder $query - * @param Model $model - * + * @param Builder $query + * @param Model $model * @return void */ public function apply(Builder $query, Model $model) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/User.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/User.php index b735b03b2..c2ea0325d 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/User.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ActiveDirectory/User.php @@ -6,6 +6,7 @@ use Carbon\Carbon; use Illuminate\Contracts\Auth\Authenticatable; use LdapRecord\Models\ActiveDirectory\Concerns\HasPrimaryGroup; use LdapRecord\Models\ActiveDirectory\Scopes\RejectComputerObjectClass; +use LdapRecord\Models\Attributes\AccountControl; use LdapRecord\Models\Concerns\CanAuthenticate; use LdapRecord\Models\Concerns\HasPassword; use LdapRecord\Query\Model\Builder; @@ -71,6 +72,38 @@ class User extends Entry implements Authenticatable static::addGlobalScope(new RejectComputerObjectClass()); } + /** + * Determine if the user's account is enabled. + * + * @return bool + */ + public function isEnabled() + { + return ! $this->isDisabled(); + } + + /** + * Determine if the user's account is disabled. + * + * @return bool + */ + public function isDisabled() + { + return $this->accountControl()->has(AccountControl::ACCOUNTDISABLE); + } + + /** + * Get the user's account control. + * + * @return AccountControl + */ + public function accountControl() + { + return new AccountControl( + $this->getFirstAttribute('userAccountControl') + ); + } + /** * The groups relationship. * @@ -110,8 +143,7 @@ class User extends Entry implements Authenticatable /** * Scopes the query to exchange mailbox users. * - * @param Builder $query - * + * @param Builder $query * @return Builder */ public function scopeWhereHasMailbox(Builder $query) @@ -122,8 +154,7 @@ class User extends Entry implements Authenticatable /** * Scopes the query to users having a lockout value set. * - * @param Builder $query - * + * @param Builder $query * @return Builder */ public function scopeWhereHasLockout(Builder $query) @@ -137,9 +168,8 @@ class User extends Entry implements Authenticatable * @see https://ldapwiki.com/wiki/Active%20Directory%20Account%20Lockout * @see https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/account-lockout-duration * - * @param string|int $localTimezone - * @param int|null $durationInMinutes - * + * @param string|int $localTimezone + * @param int|null $durationInMinutes * @return bool */ public function isLockedOut($localTimezone, $durationInMinutes = null) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/AccountControl.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/AccountControl.php index 7e2414629..45fae214d 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/AccountControl.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/AccountControl.php @@ -6,49 +6,49 @@ use ReflectionClass; class AccountControl { - const SCRIPT = 1; + public const SCRIPT = 1; - const ACCOUNTDISABLE = 2; + public const ACCOUNTDISABLE = 2; - const HOMEDIR_REQUIRED = 8; + public const HOMEDIR_REQUIRED = 8; - const LOCKOUT = 16; + public const LOCKOUT = 16; - const PASSWD_NOTREQD = 32; + public const PASSWD_NOTREQD = 32; - const PASSWD_CANT_CHANGE = 64; + public const PASSWD_CANT_CHANGE = 64; - const ENCRYPTED_TEXT_PWD_ALLOWED = 128; + public const ENCRYPTED_TEXT_PWD_ALLOWED = 128; - const TEMP_DUPLICATE_ACCOUNT = 256; + public const TEMP_DUPLICATE_ACCOUNT = 256; - const NORMAL_ACCOUNT = 512; + public const NORMAL_ACCOUNT = 512; - const INTERDOMAIN_TRUST_ACCOUNT = 2048; + public const INTERDOMAIN_TRUST_ACCOUNT = 2048; - const WORKSTATION_TRUST_ACCOUNT = 4096; + public const WORKSTATION_TRUST_ACCOUNT = 4096; - const SERVER_TRUST_ACCOUNT = 8192; + public const SERVER_TRUST_ACCOUNT = 8192; - const DONT_EXPIRE_PASSWORD = 65536; + public const DONT_EXPIRE_PASSWORD = 65536; - const MNS_LOGON_ACCOUNT = 131072; + public const MNS_LOGON_ACCOUNT = 131072; - const SMARTCARD_REQUIRED = 262144; + public const SMARTCARD_REQUIRED = 262144; - const TRUSTED_FOR_DELEGATION = 524288; + public const TRUSTED_FOR_DELEGATION = 524288; - const NOT_DELEGATED = 1048576; + public const NOT_DELEGATED = 1048576; - const USE_DES_KEY_ONLY = 2097152; + public const USE_DES_KEY_ONLY = 2097152; - const DONT_REQ_PREAUTH = 4194304; + public const DONT_REQ_PREAUTH = 4194304; - const PASSWORD_EXPIRED = 8388608; + public const PASSWORD_EXPIRED = 8388608; - const TRUSTED_TO_AUTH_FOR_DELEGATION = 16777216; + public const TRUSTED_TO_AUTH_FOR_DELEGATION = 16777216; - const PARTIAL_SECRETS_ACCOUNT = 67108864; + public const PARTIAL_SECRETS_ACCOUNT = 67108864; /** * The account control flag values. @@ -60,7 +60,7 @@ class AccountControl /** * Constructor. * - * @param ?int $flag + * @param ?int $flag */ public function __construct($flag = null) { @@ -92,8 +92,7 @@ class AccountControl /** * Add the flag to the account control values. * - * @param int $flag - * + * @param int $flag * @return $this */ public function add($flag) @@ -108,8 +107,7 @@ class AccountControl /** * Remove the flag from the account control. * - * @param int $flag - * + * @param int $flag * @return $this */ public function remove($flag) @@ -122,8 +120,7 @@ class AccountControl /** * Extract and apply the flag. * - * @param int $flag - * + * @param int $flag * @return void */ public function apply($flag) @@ -134,8 +131,7 @@ class AccountControl /** * Determine if the account control contains the given UAC flag(s). * - * @param int $flag - * + * @param int $flag * @return bool */ public function has($flag) @@ -154,8 +150,7 @@ class AccountControl /** * Determine if the account control does not contain the given UAC flag(s). * - * @param int $flag - * + * @param int $flag * @return bool */ public function doesntHave($flag) @@ -441,8 +436,7 @@ class AccountControl /** * Set the account control values. * - * @param array $flags - * + * @param array $flags * @return void */ public function setValues(array $flags) @@ -483,8 +477,7 @@ class AccountControl /** * Extracts the given flag into an array of flags used. * - * @param int $flag - * + * @param int $flag * @return array */ public function extractFlags($flag) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/DistinguishedName.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/DistinguishedName.php index c6977a8e8..fc981299a 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/DistinguishedName.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/DistinguishedName.php @@ -19,7 +19,7 @@ class DistinguishedName /** * Constructor. * - * @param string|null $value + * @param string|null $value */ public function __construct($value = null) { @@ -39,8 +39,7 @@ class DistinguishedName /** * Alias of the "build" method. * - * @param string|null $value - * + * @param string|null $value * @return DistinguishedNameBuilder */ public static function of($value = null) @@ -51,8 +50,7 @@ class DistinguishedName /** * Get a new DN builder object from the given DN. * - * @param string|null $value - * + * @param string|null $value * @return DistinguishedNameBuilder */ public static function build($value = null) @@ -63,8 +61,7 @@ class DistinguishedName /** * Make a new distinguished name instance. * - * @param string|null $value - * + * @param string|null $value * @return static */ public static function make($value = null) @@ -75,8 +72,7 @@ class DistinguishedName /** * Determine if the given value is a valid distinguished name. * - * @param string $value - * + * @param string $value * @return bool */ public static function isValid($value) @@ -87,8 +83,7 @@ class DistinguishedName /** * Explode a distinguished name into relative distinguished names. * - * @param string $dn - * + * @param string $dn * @return array */ public static function explode($dn) @@ -111,8 +106,7 @@ class DistinguishedName /** * Un-escapes a hexadecimal string into its original string representation. * - * @param string $value - * + * @param string $value * @return string */ public static function unescape($value) @@ -125,8 +119,7 @@ class DistinguishedName /** * Explode the RDN into an attribute and value. * - * @param string $rdn - * + * @param string $rdn * @return array */ public static function explodeRdn($rdn) @@ -137,8 +130,7 @@ class DistinguishedName /** * Implode the component attribute and value into an RDN. * - * @param string $rdn - * + * @param string $rdn * @return string */ public static function makeRdn(array $component) @@ -159,8 +151,7 @@ class DistinguishedName /** * Set the underlying value. * - * @param string|null $value - * + * @param string|null $value * @return $this */ public function set($value) @@ -337,8 +328,7 @@ class DistinguishedName /** * Determine if the current distinguished name is a parent of the given child. * - * @param DistinguishedName $child - * + * @param DistinguishedName $child * @return bool */ public function isParentOf(self $child) @@ -349,8 +339,7 @@ class DistinguishedName /** * Determine if the current distinguished name is a child of the given parent. * - * @param DistinguishedName $parent - * + * @param DistinguishedName $parent * @return bool */ public function isChildOf(self $parent) @@ -370,8 +359,7 @@ class DistinguishedName /** * Determine if the current distinguished name is an ancestor of the descendant. * - * @param DistinguishedName $descendant - * + * @param DistinguishedName $descendant * @return bool */ public function isAncestorOf(self $descendant) @@ -382,8 +370,7 @@ class DistinguishedName /** * Determine if the current distinguished name is a descendant of the ancestor. * - * @param DistinguishedName $ancestor - * + * @param DistinguishedName $ancestor * @return bool */ public function isDescendantOf(self $ancestor) @@ -407,9 +394,8 @@ class DistinguishedName /** * Compare whether the two distinguished name values are equal. * - * @param array $values - * @param array $other - * + * @param array $values + * @param array $other * @return bool */ protected function compare(array $values, array $other) @@ -420,8 +406,7 @@ class DistinguishedName /** * Recase the array values. * - * @param array $values - * + * @param array $values * @return array */ protected function recase(array $values) @@ -432,8 +417,7 @@ class DistinguishedName /** * Normalize the string value. * - * @param string $value - * + * @param string $value * @return string */ protected function normalize($value) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/DistinguishedNameBuilder.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/DistinguishedNameBuilder.php index 601902bf7..a0d84d828 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/DistinguishedNameBuilder.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/DistinguishedNameBuilder.php @@ -26,7 +26,7 @@ class DistinguishedNameBuilder /** * Constructor. * - * @param string|null $value + * @param string|null $value */ public function __construct($dn = null) { @@ -38,9 +38,8 @@ class DistinguishedNameBuilder /** * Forward missing method calls onto the Distinguished Name object. * - * @param string $method - * @param array $args - * + * @param string $method + * @param array $args * @return mixed */ public function __call($method, $args) @@ -61,9 +60,8 @@ class DistinguishedNameBuilder /** * Prepend an RDN onto the DN. * - * @param string|array $attribute - * @param string|null $value - * + * @param string|array $attribute + * @param string|null $value * @return $this */ public function prepend($attribute, $value = null) @@ -79,9 +77,8 @@ class DistinguishedNameBuilder /** * Append an RDN onto the DN. * - * @param string|array $attribute - * @param string|null $value - * + * @param string|array $attribute + * @param string|null $value * @return $this */ public function append($attribute, $value = null) @@ -97,9 +94,8 @@ class DistinguishedNameBuilder /** * Componentize the attribute and value. * - * @param string|array $attribute - * @param string|null $value - * + * @param string|array $attribute + * @param string|null $value * @return array */ protected function componentize($attribute, $value = null) @@ -125,8 +121,7 @@ class DistinguishedNameBuilder /** * Make a componentized array by exploding the value if it's a string. * - * @param string $value - * + * @param string $value * @return array */ protected function makeComponentizedArray($value) @@ -137,9 +132,8 @@ class DistinguishedNameBuilder /** * Make an appendable component array from the attribute and value. * - * @param string|array $attribute - * @param string|null $value - * + * @param string|array $attribute + * @param string|null $value * @return array */ protected function makeAppendableComponent($attribute, $value = null) @@ -150,9 +144,8 @@ class DistinguishedNameBuilder /** * Pop an RDN off of the end of the DN. * - * @param int $amount - * @param array $removed - * + * @param int $amount + * @param array $removed * @return $this */ public function pop($amount = 1, &$removed = []) @@ -167,9 +160,8 @@ class DistinguishedNameBuilder /** * Shift an RDN off of the beginning of the DN. * - * @param int $amount - * @param array $removed - * + * @param int $amount + * @param array $removed * @return $this */ public function shift($amount = 1, &$removed = []) @@ -196,8 +188,7 @@ class DistinguishedNameBuilder /** * Get the components of the DN. * - * @param null|string $type - * + * @param null|string $type * @return array */ public function components($type = null) @@ -210,8 +201,7 @@ class DistinguishedNameBuilder /** * Get the components of a particular type. * - * @param string $type - * + * @param string $type * @return array */ protected function componentsOfType($type) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/EscapedValue.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/EscapedValue.php index 2f6111297..3c9d4db0a 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/EscapedValue.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/EscapedValue.php @@ -28,9 +28,9 @@ class EscapedValue /** * Constructor. * - * @param string $value - * @param string $ignore - * @param int $flags + * @param string $value + * @param string $ignore + * @param int $flags */ public function __construct($value, $ignore = '', $flags = 0) { @@ -72,8 +72,7 @@ class EscapedValue /** * Set the characters to exclude from being escaped. * - * @param string $characters - * + * @param string $characters * @return $this */ public function ignore($characters) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/Guid.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/Guid.php index d139f5f86..e04b5cd3f 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/Guid.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/Guid.php @@ -50,8 +50,7 @@ class Guid /** * Determines if the specified GUID is valid. * - * @param string $guid - * + * @param string $guid * @return bool */ public static function isValid($guid) @@ -62,7 +61,7 @@ class Guid /** * Constructor. * - * @param mixed $value + * @param mixed $value * * @throws InvalidArgumentException */ @@ -128,8 +127,7 @@ class Guid /** * Returns the string variant of a binary GUID. * - * @param string $binary - * + * @param string $binary * @return string|null */ protected function binaryGuidToString($binary) @@ -144,10 +142,9 @@ class Guid * * @see https://github.com/ldaptools/ldaptools * - * @param string $hex The full hex string. - * @param array $sections An array of start and length (unless octet is true, then length is always 2). - * @param bool $octet Whether this is for octet string form. - * + * @param string $hex The full hex string. + * @param array $sections An array of start and length (unless octet is true, then length is always 2). + * @param bool $octet Whether this is for octet string form. * @return string The concatenated sections in upper-case. */ protected function parseSection($hex, array $sections, $octet = false) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/MbString.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/MbString.php index 672e60df1..72d4c6f48 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/MbString.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/MbString.php @@ -7,8 +7,7 @@ class MbString /** * Get the integer value of a specific character. * - * @param $string - * + * @param $string * @return int */ public static function ord($string) @@ -27,8 +26,7 @@ class MbString /** * Get the character for a specific integer value. * - * @param $int - * + * @param $int * @return string */ public static function chr($int) @@ -43,8 +41,7 @@ class MbString /** * Split a string into its individual characters and return it as an array. * - * @param string $value - * + * @param string $value * @return string[] */ public static function split($value) @@ -55,8 +52,7 @@ class MbString /** * Detects if the given string is UTF 8. * - * @param $string - * + * @param $string * @return string|false */ public static function isUtf8($string) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/Password.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/Password.php index 644f0a8d3..d7047a375 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/Password.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/Password.php @@ -8,15 +8,14 @@ use ReflectionMethod; class Password { - const CRYPT_SALT_TYPE_MD5 = 1; - const CRYPT_SALT_TYPE_SHA256 = 5; - const CRYPT_SALT_TYPE_SHA512 = 6; + public const CRYPT_SALT_TYPE_MD5 = 1; + public const CRYPT_SALT_TYPE_SHA256 = 5; + public const CRYPT_SALT_TYPE_SHA512 = 6; /** * Make an encoded password for transmission over LDAP. * - * @param string $password - * + * @param string $password * @return string */ public static function encode($password) @@ -27,9 +26,8 @@ class Password /** * Make a salted md5 password. * - * @param string $password - * @param null|string $salt - * + * @param string $password + * @param null|string $salt * @return string */ public static function smd5($password, $salt = null) @@ -40,9 +38,8 @@ class Password /** * Make a salted SHA password. * - * @param string $password - * @param null|string $salt - * + * @param string $password + * @param null|string $salt * @return string */ public static function ssha($password, $salt = null) @@ -53,9 +50,8 @@ class Password /** * Make a salted SSHA256 password. * - * @param string $password - * @param null|string $salt - * + * @param string $password + * @param null|string $salt * @return string */ public static function ssha256($password, $salt = null) @@ -66,9 +62,8 @@ class Password /** * Make a salted SSHA384 password. * - * @param string $password - * @param null|string $salt - * + * @param string $password + * @param null|string $salt * @return string */ public static function ssha384($password, $salt = null) @@ -79,9 +74,8 @@ class Password /** * Make a salted SSHA512 password. * - * @param string $password - * @param null|string $salt - * + * @param string $password + * @param null|string $salt * @return string */ public static function ssha512($password, $salt = null) @@ -92,8 +86,7 @@ class Password /** * Make a non-salted SHA password. * - * @param string $password - * + * @param string $password * @return string */ public static function sha($password) @@ -104,8 +97,7 @@ class Password /** * Make a non-salted SHA256 password. * - * @param string $password - * + * @param string $password * @return string */ public static function sha256($password) @@ -116,8 +108,7 @@ class Password /** * Make a non-salted SHA384 password. * - * @param string $password - * + * @param string $password * @return string */ public static function sha384($password) @@ -128,8 +119,7 @@ class Password /** * Make a non-salted SHA512 password. * - * @param string $password - * + * @param string $password * @return string */ public static function sha512($password) @@ -140,8 +130,7 @@ class Password /** * Make a non-salted md5 password. * - * @param string $password - * + * @param string $password * @return string */ public static function md5($password) @@ -149,12 +138,22 @@ class Password return '{MD5}'.static::makeHash($password, 'md5'); } + /** + * Make a non-salted NThash password. + * + * @param string $password + * @return string + */ + public static function nthash($password) + { + return '{NTHASH}'.strtoupper(hash('md4', iconv('UTF-8', 'UTF-16LE', $password))); + } + /** * Crypt password with an MD5 salt. * - * @param string $password - * @param string $salt - * + * @param string $password + * @param string $salt * @return string */ public static function md5Crypt($password, $salt = null) @@ -165,9 +164,8 @@ class Password /** * Crypt password with a SHA256 salt. * - * @param string $password - * @param string $salt - * + * @param string $password + * @param string $salt * @return string */ public static function sha256Crypt($password, $salt = null) @@ -178,9 +176,8 @@ class Password /** * Crypt a password with a SHA512 salt. * - * @param string $password - * @param string $salt - * + * @param string $password + * @param string $salt * @return string */ public static function sha512Crypt($password, $salt = null) @@ -191,11 +188,10 @@ class Password /** * Make a new password hash. * - * @param string $password The password to make a hash of. - * @param string $method The hash function to use. - * @param string|null $algo The algorithm to use for hashing. - * @param string|null $salt The salt to append onto the hash. - * + * @param string $password The password to make a hash of. + * @param string $method The hash function to use. + * @param string|null $algo The algorithm to use for hashing. + * @param string|null $salt The salt to append onto the hash. * @return string */ protected static function makeHash($password, $method, $algo = null, $salt = null) @@ -208,10 +204,9 @@ class Password /** * Make a hashed password. * - * @param string $password - * @param int $type - * @param null|string $salt - * + * @param string $password + * @param int $type + * @param null|string $salt * @return string */ protected static function makeCrypt($password, $type, $salt = null) @@ -222,8 +217,7 @@ class Password /** * Make a salt for the crypt() method using the given type. * - * @param int $type - * + * @param int $type * @return string */ protected static function makeCryptSalt($type) @@ -242,8 +236,7 @@ class Password /** * Determine the crypt prefix and length. * - * @param int $type - * + * @param int $type * @return array * * @throws InvalidArgumentException @@ -265,8 +258,7 @@ class Password /** * Attempt to retrieve the hash method used for the password. * - * @param string $password - * + * @param string $password * @return string|void */ public static function getHashMethod($password) @@ -281,8 +273,7 @@ class Password /** * Attempt to retrieve the hash method and algorithm used for the password. * - * @param string $password - * + * @param string $password * @return array|void */ public static function getHashMethodAndAlgo($password) @@ -319,8 +310,7 @@ class Password /** * Determine if the hash method requires a salt to be given. * - * @param string $method - * + * @param string $method * @return bool * * @throws \ReflectionException diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/Sid.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/Sid.php index 4ec46ea71..7760453ce 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/Sid.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/Sid.php @@ -17,8 +17,7 @@ class Sid /** * Determines if the specified SID is valid. * - * @param string $sid - * + * @param string $sid * @return bool */ public static function isValid($sid) @@ -29,7 +28,7 @@ class Sid /** * Constructor. * - * @param mixed $value + * @param mixed $value * * @throws InvalidArgumentException */ @@ -90,8 +89,7 @@ class Sid /** * Returns the string variant of a binary SID. * - * @param string $binary - * + * @param string $binary * @return string|null */ protected function binarySidToString($binary) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/TSProperty.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/TSProperty.php index ad56aa130..499579f82 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/TSProperty.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/TSProperty.php @@ -7,7 +7,7 @@ class TSProperty /** * Nibble control values. The first value for each is if the nibble is <= 9, otherwise the second value is used. */ - const NIBBLE_CONTROL = [ + public const NIBBLE_CONTROL = [ 'X' => ['001011', '011010'], 'Y' => ['001110', '011010'], ]; @@ -15,12 +15,12 @@ class TSProperty /** * The nibble header. */ - const NIBBLE_HEADER = '1110'; + public const NIBBLE_HEADER = '1110'; /** * Conversion factor needed for time values in the TSPropertyArray (stored in microseconds). */ - const TIME_CONVERSION = 60 * 1000; + public const TIME_CONVERSION = 60 * 1000; /** * A simple map to help determine how the property needs to be decoded/encoded from/to its binary value. @@ -85,7 +85,7 @@ class TSProperty /** * Pass binary TSProperty data to construct its object representation. * - * @param string|null $value + * @param string|null $value */ public function __construct($value = null) { @@ -97,8 +97,7 @@ class TSProperty /** * Set the name for the TSProperty. * - * @param string $name - * + * @param string $name * @return TSProperty */ public function setName($name) @@ -121,8 +120,7 @@ class TSProperty /** * Set the value for the TSProperty. * - * @param string|int $value - * + * @param string|int $value * @return TSProperty */ public function setValue($value) @@ -169,7 +167,7 @@ class TSProperty /** * Given a TSProperty blob, decode the name/value/type/etc. * - * @param string $tsProperty + * @param string $tsProperty */ protected function decode($tsProperty) { @@ -186,9 +184,8 @@ class TSProperty /** * Based on the property name/value in question, get its encoded form. * - * @param string $propName - * @param string|int $propValue - * + * @param string $propName + * @param string|int $propValue * @return string */ protected function getEncodedValueForProp($propName, $propValue) @@ -210,9 +207,8 @@ class TSProperty /** * Based on the property name in question, get its actual value from the binary blob value. * - * @param string $propName - * @param string $propValue - * + * @param string $propName + * @param string $propValue * @return string|int */ protected function getDecodedValueForProp($propName, $propValue) @@ -238,9 +234,8 @@ class TSProperty * Decode the property by inspecting the nibbles of each blob, checking * the control, and adding up the results into a final value. * - * @param string $hex - * @param bool $string Whether or not this is simple string data. - * + * @param string $hex + * @param bool $string Whether or not this is simple string data. * @return string */ protected function decodePropValue($hex, $string = false) @@ -272,9 +267,8 @@ class TSProperty /** * Get the encoded property value as a binary blob. * - * @param string $value - * @param bool $string - * + * @param string $value + * @param bool $string * @return string */ protected function encodePropValue($value, $string = false) @@ -314,9 +308,8 @@ class TSProperty * a workaround that turns a literal bit-string into a * packed byte-string with 8 bits per byte. * - * @param string $bits - * @param bool $len - * + * @param string $bits + * @param bool $len * @return string */ protected function packBitString($bits, $len) @@ -337,9 +330,8 @@ class TSProperty /** * Based on the control, adjust the nibble accordingly. * - * @param string $nibble - * @param string $control - * + * @param string $nibble + * @param string $control * @return string */ protected function nibbleControl($nibble, $control) @@ -362,9 +354,8 @@ class TSProperty * the control for X or Y equals 011010. Additionally, if the dec value of the nibble is > 9, then the nibble value * must be subtracted by 9 before the final value is constructed. * - * @param string $nibbleType Either X or Y - * @param string $nibble - * + * @param string $nibbleType Either X or Y + * @param string $nibble * @return string */ protected function getNibbleWithControl($nibbleType, $nibble) @@ -384,9 +375,8 @@ class TSProperty /** * Need to make sure hex values are always an even length, so pad as needed. * - * @param int $int - * @param int $padLength The hex string must be padded to this length (with zeros). - * + * @param int $int + * @param int $padLength The hex string must be padded to this length (with zeros). * @return string */ protected function dec2hex($int, $padLength = 2) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/TSPropertyArray.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/TSPropertyArray.php index 18316888f..8320dd8ed 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/TSPropertyArray.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/TSPropertyArray.php @@ -9,14 +9,14 @@ class TSPropertyArray /** * Represents that the TSPropertyArray data is valid. */ - const VALID_SIGNATURE = 'P'; + public const VALID_SIGNATURE = 'P'; /** * The default values for the TSPropertyArray structure. * * @var array */ - const DEFAULTS = [ + public const DEFAULTS = [ 'CtxCfgPresent' => 2953518677, 'CtxWFProfilePath' => '', 'CtxWFProfilePathW' => '', @@ -71,7 +71,7 @@ class TSPropertyArray * - Pass the userParameters binary value. The object representation of that will be decoded and constructed. * - Pass nothing and a default set of TSProperty key => value pairs will be used (See DEFAULTS constant). * - * @param mixed $tsPropertyArray + * @param mixed $tsPropertyArray */ public function __construct($tsPropertyArray = null) { @@ -93,8 +93,7 @@ class TSPropertyArray /** * Check if a specific TSProperty exists by its property name. * - * @param string $propName - * + * @param string $propName * @return bool */ public function has($propName) @@ -105,8 +104,7 @@ class TSPropertyArray /** * Get a TSProperty object by its property name (ie. CtxWFProfilePath). * - * @param string $propName - * + * @param string $propName * @return TSProperty */ public function get($propName) @@ -119,8 +117,7 @@ class TSPropertyArray /** * Add a TSProperty object. If it already exists, it will be overwritten. * - * @param TSProperty $tsProperty - * + * @param TSProperty $tsProperty * @return $this */ public function add(TSProperty $tsProperty) @@ -133,8 +130,7 @@ class TSPropertyArray /** * Remove a TSProperty by its property name (ie. CtxMinEncryptionLevel). * - * @param string $propName - * + * @param string $propName * @return $this */ public function remove($propName) @@ -151,9 +147,8 @@ class TSPropertyArray /** * Set the value for a specific TSProperty by its name. * - * @param string $propName - * @param mixed $propValue - * + * @param string $propName + * @param mixed $propValue * @return $this */ public function set($propName, $propValue) @@ -214,7 +209,7 @@ class TSPropertyArray /** * Validates that the given property name exists. * - * @param string $propName + * @param string $propName */ protected function validateProp($propName) { @@ -224,8 +219,7 @@ class TSPropertyArray } /** - * @param string $propName - * + * @param string $propName * @return TSProperty */ protected function getTsPropObj($propName) @@ -236,8 +230,7 @@ class TSPropertyArray /** * Get an associative array with all of the userParameters property names and values. * - * @param string $userParameters - * + * @param string $userParameters * @return void */ protected function decodeUserParameters($userParameters) @@ -260,7 +253,7 @@ class TSPropertyArray // Reserved data length + (count and sig length == 4) + the added lengths of the TSPropertyArray // This saves anything after that variable TSPropertyArray data, so as to not squash anything stored there if (strlen($userParameters) > (96 + 4 + $length)) { - $this->postBinary = hex2bin(substr($userParameters, (96 + 4 + $length))); + $this->postBinary = hex2bin(substr($userParameters, 96 + 4 + $length)); } } @@ -270,9 +263,8 @@ class TSPropertyArray * individual TSProperty structures. Return the full length * of the TSPropertyArray data. * - * @param string $tsPropertyArray - * @param int $tsPropCount - * + * @param string $tsPropertyArray + * @param int $tsPropCount * @return int The length of the data in the TSPropertyArray */ protected function addTSPropData($tsPropertyArray, $tsPropCount) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/Timestamp.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/Timestamp.php index e5d9dc341..0f07bc5a0 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/Timestamp.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Attributes/Timestamp.php @@ -5,11 +5,14 @@ namespace LdapRecord\Models\Attributes; use Carbon\Carbon; use Carbon\CarbonInterface; use DateTime; +use DateTimeZone; use LdapRecord\LdapRecordException; use LdapRecord\Utilities; class Timestamp { + public const WINDOWS_INT_MAX = 9223372036854775807; + /** * The current timestamp type. * @@ -31,7 +34,7 @@ class Timestamp /** * Constructor. * - * @param string $type + * @param string $type * * @throws LdapRecordException */ @@ -43,7 +46,7 @@ class Timestamp /** * Set the type of timestamp to convert from / to. * - * @param string $type + * @param string $type * * @throws LdapRecordException */ @@ -59,8 +62,7 @@ class Timestamp /** * Converts the value to an LDAP date string. * - * @param mixed $value - * + * @param mixed $value * @return float|string * * @throws LdapRecordException @@ -107,21 +109,19 @@ class Timestamp /** * Determine if the value given is in Windows Integer (NTFS Filetime) format. * - * @param int|string $value - * + * @param int|string $value * @return bool */ protected function valueIsWindowsIntegerType($value) { - return is_numeric($value) && strlen((string) $value) === 18; + return is_numeric($value) && in_array(strlen((string) $value), [18, 19]); } /** * Converts the LDAP timestamp value to a Carbon instance. * - * @param mixed $value - * - * @return Carbon|false + * @param mixed $value + * @return Carbon|int|false * * @throws LdapRecordException */ @@ -153,14 +153,13 @@ class Timestamp /** * Converts standard LDAP timestamps to a date time object. * - * @param string $value - * + * @param string $value * @return DateTime|false */ protected function convertLdapTimeToDateTime($value) { return DateTime::createFromFormat( - strpos($value, 'Z') !== false ? 'YmdHis\Z' : 'YmdHisT', + str_contains((string) $value, 'Z') ? 'YmdHis\Z' : 'YmdHisT', $value ); } @@ -168,8 +167,7 @@ class Timestamp /** * Converts date objects to a standard LDAP timestamp. * - * @param DateTime $date - * + * @param DateTime $date * @return string */ protected function convertDateTimeToLdapTime(DateTime $date) @@ -182,23 +180,22 @@ class Timestamp /** * Converts standard windows timestamps to a date time object. * - * @param string $value - * + * @param string $value * @return DateTime|false */ protected function convertWindowsTimeToDateTime($value) { return DateTime::createFromFormat( - strpos($value, '0Z') !== false ? 'YmdHis.0\Z' : 'YmdHis.0T', - $value + str_contains((string) $value, '0Z') ? 'YmdHis.0\Z' : 'YmdHis.0T', + $value, + new DateTimeZone('UTC') ); } /** * Converts date objects to a windows timestamp. * - * @param DateTime $date - * + * @param DateTime $date * @return string */ protected function convertDateTimeToWindows(DateTime $date) @@ -211,20 +208,25 @@ class Timestamp /** * Converts standard windows integer dates to a date time object. * - * @param int $value - * - * @return DateTime|false + * @param int $value + * @return DateTime|int|false * * @throws \Exception */ protected function convertWindowsIntegerTimeToDateTime($value) { - // ActiveDirectory dates that contain integers may return - // "0" when they are not set. We will validate that here. - if (! $value) { + if (is_null($value) || $value === '') { return false; } + if ($value == 0) { + return (int) $value; + } + + if ($value == static::WINDOWS_INT_MAX) { + return (int) $value; + } + return (new DateTime())->setTimestamp( Utilities::convertWindowsTimeToUnixTime($value) ); @@ -233,8 +235,7 @@ class Timestamp /** * Converts date objects to a windows integer timestamp. * - * @param DateTime $date - * + * @param DateTime $date * @return float */ protected function convertDateTimeToWindowsInteger(DateTime $date) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/BatchModification.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/BatchModification.php index 37f0e876b..954c58fcf 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/BatchModification.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/BatchModification.php @@ -11,9 +11,9 @@ class BatchModification /** * The array keys to be used in batch modifications. */ - const KEY_ATTRIB = 'attrib'; - const KEY_MODTYPE = 'modtype'; - const KEY_VALUES = 'values'; + public const KEY_ATTRIB = 'attrib'; + public const KEY_MODTYPE = 'modtype'; + public const KEY_VALUES = 'values'; /** * The attribute of the modification. @@ -46,9 +46,9 @@ class BatchModification /** * Constructor. * - * @param string|null $attribute - * @param string|int|null $type - * @param array $values + * @param string|null $attribute + * @param string|int|null $type + * @param array $values */ public function __construct($attribute = null, $type = null, array $values = []) { @@ -60,8 +60,7 @@ class BatchModification /** * Set the original value of the attribute before modification. * - * @param array|string $original - * + * @param array|string $original * @return $this */ public function setOriginal($original = []) @@ -84,8 +83,7 @@ class BatchModification /** * Set the attribute of the modification. * - * @param string $attribute - * + * @param string $attribute * @return $this */ public function setAttribute($attribute) @@ -108,8 +106,7 @@ class BatchModification /** * Set the values of the modification. * - * @param array $values - * + * @param array $values * @return $this */ public function setValues(array $values = []) @@ -127,8 +124,7 @@ class BatchModification /** * Normalize all of the attribute values. * - * @param array|string $values - * + * @param array|string $values * @return array */ protected function normalizeAttributeValues($values = []) @@ -152,8 +148,7 @@ class BatchModification /** * Set the type of the modification. * - * @param int|null $type - * + * @param int|null $type * @return $this */ public function setType($type = null) @@ -207,7 +202,7 @@ class BatchModification case empty($this->original) && ! empty($this->values): return $this->setType(LDAP_MODIFY_BATCH_ADD); default: - return $this->determineBatchTypeFromOriginal(); + return $this->determineBatchTypeFromOriginal(); } } @@ -291,8 +286,7 @@ class BatchModification /** * Determines if the given modtype is valid. * - * @param int $type - * + * @param int $type * @return bool */ protected function isValidType($type) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Collection.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Collection.php index 850167b7e..11b4ca522 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Collection.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Collection.php @@ -9,11 +9,22 @@ use LdapRecord\Support\Arr; class Collection extends QueryCollection { + /** + * Get a collection of the model's distinguished names. + * + * @return static + */ + public function modelDns() + { + return $this->map(function (Model $model) { + return $model->getDn(); + }); + } + /** * Determine if the collection contains all of the given models, or any models. * - * @param mixed $models - * + * @param mixed $models * @return bool */ public function exists($models = null) @@ -47,10 +58,9 @@ class Collection extends QueryCollection /** * Determine if any of the given models are contained in the collection. * - * @param mixed $key - * @param mixed $operator - * @param mixed $value - * + * @param mixed $key + * @param mixed $operator + * @param mixed $value * @return bool */ public function contains($key, $operator = null, $value = null) @@ -78,8 +88,7 @@ class Collection extends QueryCollection /** * Get the provided models as an array. * - * @param mixed $models - * + * @param mixed $models * @return array */ protected function getArrayableModels($models = null) @@ -92,17 +101,16 @@ class Collection extends QueryCollection /** * Compare the related model with the given. * - * @param Model|string $model - * @param Model $related - * + * @param Model|string $model + * @param Model $related * @return bool */ protected function compareModelWithRelated($model, $related) { if (is_string($model)) { return $this->isValidDn($model) - ? $related->getDn() == $model - : $related->getName() == $model; + ? strcasecmp($related->getDn(), $model) === 0 + : strcasecmp($related->getName(), $model) === 0; } return $related->is($model); @@ -111,8 +119,7 @@ class Collection extends QueryCollection /** * Determine if the given string is a valid distinguished name. * - * @param string $dn - * + * @param string $dn * @return bool */ protected function isValidDn($dn) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/CanAuthenticate.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/CanAuthenticate.php index 451738abe..6e8d4fb5d 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/CanAuthenticate.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/CanAuthenticate.php @@ -2,6 +2,7 @@ namespace LdapRecord\Models\Concerns; +/** @mixin \LdapRecord\Models\Model */ trait CanAuthenticate { /** @@ -17,7 +18,7 @@ trait CanAuthenticate /** * Get the unique identifier for the user. * - * @return mixed + * @return string */ public function getAuthIdentifier() { @@ -47,8 +48,7 @@ trait CanAuthenticate /** * Set the token value for the "remember me" session. * - * @param string $value - * + * @param string $value * @return void */ public function setRememberToken($value) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HasAttributes.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HasAttributes.php index b5f333579..a3d9df7d9 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HasAttributes.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HasAttributes.php @@ -74,6 +74,18 @@ trait HasAttributes */ protected static $mutatorCache = []; + /** + * Convert the model's original attributes to an array. + * + * @return array + */ + public function originalToArray() + { + return $this->encodeAttributes( + $this->convertAttributesForJson($this->original) + ); + } + /** * Convert the model's attributes to an array. * @@ -111,11 +123,38 @@ trait HasAttributes return $this->encodeAttributes($attributes); } + /** + * Convert the model's serialized original attributes to their original form. + * + * @param array $attributes + * @return array + */ + public function arrayToOriginal(array $attributes) + { + return $this->decodeAttributes( + $this->convertAttributesFromJson($attributes) + ); + } + + /** + * Convert the model's serialized attributes to their original form. + * + * @param array $attributes + * @return array + */ + public function arrayToAttributes(array $attributes) + { + $attributes = $this->restoreDateAttributesFromArray($attributes); + + return $this->decodeAttributes( + $this->convertAttributesFromJson($attributes) + ); + } + /** * Add the date attributes to the attributes array. * - * @param array $attributes - * + * @param array $attributes * @return array */ protected function addDateAttributesToArray(array $attributes) @@ -135,11 +174,31 @@ trait HasAttributes return $attributes; } + /** + * Restore the date attributes to their true value from serialized attributes. + * + * @param array $attributes + * @return array + */ + protected function restoreDateAttributesFromArray(array $attributes) + { + foreach ($this->getDates() as $attribute => $type) { + if (! isset($attributes[$attribute])) { + continue; + } + + $date = $this->fromDateTime($type, $attributes[$attribute]); + + $attributes[$attribute] = Arr::wrap($date); + } + + return $attributes; + } + /** * Prepare a date for array / JSON serialization. * - * @param DateTimeInterface $date - * + * @param DateTimeInterface $date * @return string */ protected function serializeDate(DateTimeInterface $date) @@ -162,10 +221,24 @@ trait HasAttributes } /** - * Encode the given value for proper serialization. + * Recursively UTF-8 decode the given attributes. * - * @param string $value + * @param array $attributes + * @return array + */ + public function decodeAttributes($attributes) + { + array_walk_recursive($attributes, function (&$value) { + $value = $this->decodeValue($value); + }); + + return $attributes; + } + + /** + * Encode the value for serialization. * + * @param string $value * @return string */ protected function encodeValue($value) @@ -173,15 +246,33 @@ trait HasAttributes // If we are able to detect the encoding, we will // encode only the attributes that need to be, // so that we do not double encode values. - return MbString::isLoaded() && MbString::isUtf8($value) ? $value : utf8_encode($value); + if (MbString::isLoaded() && MbString::isUtf8($value)) { + return $value; + } + + return utf8_encode($value); + } + + /** + * Decode the value from serialization. + * + * @param string $value + * @return string + */ + protected function decodeValue($value) + { + if (MbString::isLoaded() && MbString::isUtf8($value)) { + return mb_convert_encoding($value, 'UTF-8', 'ISO-8859-1'); + } + + return $value; } /** * Add the mutated attributes to the attributes array. * - * @param array $attributes - * @param array $mutatedAttributes - * + * @param array $attributes + * @param array $mutatedAttributes * @return array */ protected function addMutatedAttributesToArray(array $attributes, array $mutatedAttributes) @@ -221,8 +312,7 @@ trait HasAttributes /** * Fills the entry with the supplied attributes. * - * @param array $attributes - * + * @param array $attributes * @return $this */ public function fill(array $attributes = []) @@ -237,9 +327,8 @@ trait HasAttributes /** * Returns the models attribute by its key. * - * @param int|string $key - * @param mixed $default - * + * @param int|string $key + * @param mixed $default * @return mixed */ public function getAttribute($key, $default = null) @@ -254,9 +343,8 @@ trait HasAttributes /** * Get an attributes value. * - * @param string $key - * @param mixed $default - * + * @param string $key + * @param mixed $default * @return mixed */ public function getAttributeValue($key, $default = null) @@ -282,8 +370,7 @@ trait HasAttributes /** * Determine if the given attribute is a date. * - * @param string $key - * + * @param string $key * @return bool */ public function isDateAttribute($key) @@ -310,9 +397,8 @@ trait HasAttributes /** * Convert the given date value to an LDAP compatible value. * - * @param string $type - * @param mixed $value - * + * @param string $type + * @param mixed $value * @return float|string * * @throws LdapRecordException @@ -325,9 +411,8 @@ trait HasAttributes /** * Convert the given LDAP date value to a Carbon instance. * - * @param mixed $value - * @param string $type - * + * @param mixed $value + * @param string $type * @return Carbon|false * * @throws LdapRecordException @@ -340,9 +425,8 @@ trait HasAttributes /** * Determine whether an attribute should be cast to a native type. * - * @param string $key - * @param array|string|null $types - * + * @param string $key + * @param array|string|null $types * @return bool */ public function hasCast($key, $types = null) @@ -367,8 +451,7 @@ trait HasAttributes /** * Determine whether a value is JSON castable for inbound manipulation. * - * @param string $key - * + * @param string $key * @return bool */ protected function isJsonCastable($key) @@ -379,8 +462,7 @@ trait HasAttributes /** * Get the type of cast for a model attribute. * - * @param string $key - * + * @param string $key * @return string */ protected function getCastType($key) @@ -399,8 +481,7 @@ trait HasAttributes /** * Determine if the cast is a decimal. * - * @param string $cast - * + * @param string $cast * @return bool */ protected function isDecimalCast($cast) @@ -411,8 +492,7 @@ trait HasAttributes /** * Determine if the cast is a datetime. * - * @param string $cast - * + * @param string $cast * @return bool */ protected function isDateTimeCast($cast) @@ -423,8 +503,7 @@ trait HasAttributes /** * Determine if the given attribute must be casted. * - * @param string $key - * + * @param string $key * @return bool */ protected function isCastedAttribute($key) @@ -435,9 +514,8 @@ trait HasAttributes /** * Cast an attribute to a native PHP type. * - * @param string $key - * @param array|null $value - * + * @param string $key + * @param array|null $value * @return mixed */ protected function castAttribute($key, $value) @@ -490,9 +568,8 @@ trait HasAttributes /** * Cast the given attribute to JSON. * - * @param string $key - * @param mixed $value - * + * @param string $key + * @param mixed $value * @return string */ protected function castAttributeAsJson($key, $value) @@ -522,8 +599,7 @@ trait HasAttributes /** * Encode the given value as JSON. * - * @param mixed $value - * + * @param mixed $value * @return string */ protected function asJson($value) @@ -534,9 +610,8 @@ trait HasAttributes /** * Decode the given JSON back into an array or object. * - * @param string $value - * @param bool $asObject - * + * @param string $value + * @param bool $asObject * @return mixed */ public function fromJson($value, $asObject = false) @@ -547,8 +622,7 @@ trait HasAttributes /** * Decode the given float. * - * @param mixed $value - * + * @param mixed $value * @return mixed */ public function fromFloat($value) @@ -568,8 +642,7 @@ trait HasAttributes /** * Cast the value to a boolean. * - * @param mixed $value - * + * @param mixed $value * @return bool */ protected function asBoolean($value) @@ -582,9 +655,8 @@ trait HasAttributes /** * Cast a decimal value as a string. * - * @param float $value - * @param int $decimals - * + * @param float $value + * @param int $decimals * @return string */ protected function asDecimal($value, $decimals) @@ -605,8 +677,7 @@ trait HasAttributes /** * Get an attribute array of all arrayable values. * - * @param array $values - * + * @param array $values * @return array */ protected function getArrayableItems(array $values) @@ -651,8 +722,7 @@ trait HasAttributes /** * Set the date format used by the model for serialization. * - * @param string $format - * + * @param string $format * @return $this */ public function setDateFormat($format) @@ -665,8 +735,7 @@ trait HasAttributes /** * Get an attribute from the $attributes array. * - * @param string $key - * + * @param string $key * @return mixed */ protected function getAttributeFromArray($key) @@ -687,9 +756,8 @@ trait HasAttributes /** * Returns the first attribute by the specified key. * - * @param string $key - * @param mixed $default - * + * @param string $key + * @param mixed $default * @return mixed */ public function getFirstAttribute($key, $default = null) @@ -712,9 +780,8 @@ trait HasAttributes /** * Set an attribute value by the specified key. * - * @param string $key - * @param mixed $value - * + * @param string $key + * @param mixed $value * @return $this */ public function setAttribute($key, $value) @@ -743,9 +810,8 @@ trait HasAttributes /** * Set an attribute on the model. No checking is done. * - * @param string $key - * @param mixed $value - * + * @param string $key + * @param mixed $value * @return $this */ public function setRawAttribute($key, $value) @@ -760,9 +826,8 @@ trait HasAttributes /** * Set the models first attribute value. * - * @param string $key - * @param mixed $value - * + * @param string $key + * @param mixed $value * @return $this */ public function setFirstAttribute($key, $value) @@ -773,9 +838,8 @@ trait HasAttributes /** * Add a unique value to the given attribute. * - * @param string $key - * @param mixed $value - * + * @param string $key + * @param mixed $value * @return $this */ public function addAttributeValue($key, $value) @@ -791,8 +855,7 @@ trait HasAttributes /** * Determine if a get mutator exists for an attribute. * - * @param string $key - * + * @param string $key * @return bool */ public function hasGetMutator($key) @@ -803,8 +866,7 @@ trait HasAttributes /** * Determine if a set mutator exists for an attribute. * - * @param string $key - * + * @param string $key * @return bool */ public function hasSetMutator($key) @@ -815,9 +877,8 @@ trait HasAttributes /** * Set the value of an attribute using its mutator. * - * @param string $key - * @param mixed $value - * + * @param string $key + * @param mixed $value * @return mixed */ protected function setMutatedAttributeValue($key, $value) @@ -828,9 +889,8 @@ trait HasAttributes /** * Get the value of an attribute using its mutator. * - * @param string $key - * @param mixed $value - * + * @param string $key + * @param mixed $value * @return mixed */ protected function getMutatedAttributeValue($key, $value) @@ -843,8 +903,7 @@ trait HasAttributes * * Hyphenated attributes will use pascal cased methods. * - * @param string $key - * + * @param string $key * @return mixed */ protected function getMutatorMethodName($key) @@ -857,9 +916,8 @@ trait HasAttributes /** * Get the value of an attribute using its mutator for array conversion. * - * @param string $key - * @param mixed $value - * + * @param string $key + * @param mixed $value * @return array */ protected function mutateAttributeForArray($key, $value) @@ -874,8 +932,7 @@ trait HasAttributes * * Used when constructing an existing LDAP record. * - * @param array $attributes - * + * @param array $attributes * @return $this */ public function setRawAttributes(array $attributes = []) @@ -915,9 +972,8 @@ trait HasAttributes /** * Filters the count key recursively from raw LDAP attributes. * - * @param array $attributes - * @param array $keys - * + * @param array $attributes + * @param array $keys * @return array */ public function filterRawAttributes(array $attributes = [], array $keys = ['count', 'dn']) @@ -938,8 +994,7 @@ trait HasAttributes /** * Determine if the model has the given attribute. * - * @param int|string $key - * + * @param int|string $key * @return bool */ public function hasAttribute($key) @@ -991,8 +1046,7 @@ trait HasAttributes /** * Determine if the given attribute is dirty. * - * @param string $key - * + * @param string $key * @return bool */ public function isDirty($key) @@ -1013,8 +1067,7 @@ trait HasAttributes /** * Set the accessors to append to model arrays. * - * @param array $appends - * + * @param array $appends * @return $this */ public function setAppends(array $appends) @@ -1027,8 +1080,7 @@ trait HasAttributes /** * Return whether the accessor attribute has been appended. * - * @param string $attribute - * + * @param string $attribute * @return bool */ public function hasAppended($attribute) @@ -1039,8 +1091,7 @@ trait HasAttributes /** * Returns a normalized attribute key. * - * @param string $key - * + * @param string $key * @return string */ public function normalizeAttributeKey($key) @@ -1056,8 +1107,7 @@ trait HasAttributes /** * Determine if the new and old values for a given key are equivalent. * - * @param string $key - * + * @param string $key * @return bool */ protected function originalIsEquivalent($key) @@ -1097,8 +1147,7 @@ trait HasAttributes /** * Extract and cache all the mutated attributes of a class. * - * @param string $class - * + * @param string $class * @return void */ public static function cacheMutatedAttributes($class) @@ -1113,8 +1162,7 @@ trait HasAttributes /** * Get all of the attribute mutator methods. * - * @param mixed $class - * + * @param mixed $class * @return array */ protected static function getMutatorMethods($class) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HasEvents.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HasEvents.php index 5adec96ea..d9a41b892 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HasEvents.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HasEvents.php @@ -4,15 +4,17 @@ namespace LdapRecord\Models\Concerns; use Closure; use LdapRecord\Events\NullDispatcher; +use LdapRecord\Models\Events; use LdapRecord\Models\Events\Event; +use LdapRecord\Support\Arr; +/** @mixin \LdapRecord\Models\Model */ trait HasEvents { /** * Execute the callback without raising any events. * - * @param Closure $callback - * + * @param Closure $callback * @return mixed */ protected static function withoutEvents(Closure $callback) @@ -37,10 +39,37 @@ trait HasEvents } /** - * Fires the specified model event. + * Dispatch the given model events. * - * @param Event $event + * @param string|array $events + * @param array $args + * @return void + */ + protected function dispatch($events, array $args = []) + { + foreach (Arr::wrap($events) as $name) { + $this->fireCustomModelEvent($name, $args); + } + } + + /** + * Fire a custom model event. * + * @param string $name + * @param array $args + * @return mixed + */ + protected function fireCustomModelEvent($name, array $args = []) + { + $event = implode('\\', [Events::class, ucfirst($name)]); + + return $this->fireModelEvent(new $event($this, ...$args)); + } + + /** + * Fire a model event. + * + * @param Event $event * @return mixed */ protected function fireModelEvent(Event $event) @@ -49,11 +78,10 @@ trait HasEvents } /** - * Listens to a model event. - * - * @param string $event - * @param Closure $listener + * Listen to a model event. * + * @param string $event + * @param Closure $listener * @return mixed */ protected function listenForModelEvent($event, Closure $listener) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HasGlobalScopes.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HasGlobalScopes.php index f7552c1b4..4d0f2968f 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HasGlobalScopes.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HasGlobalScopes.php @@ -6,14 +6,14 @@ use Closure; use InvalidArgumentException; use LdapRecord\Models\Scope; +/** @mixin \LdapRecord\Models\Model */ trait HasGlobalScopes { /** * Register a new global scope on the model. * - * @param Scope|Closure|string $scope - * @param Closure|null $implementation - * + * @param Scope|Closure|string $scope + * @param Closure|null $implementation * @return mixed * * @throws InvalidArgumentException @@ -34,8 +34,7 @@ trait HasGlobalScopes /** * Determine if a model has a global scope. * - * @param Scope|string $scope - * + * @param Scope|string $scope * @return bool */ public static function hasGlobalScope($scope) @@ -46,8 +45,7 @@ trait HasGlobalScopes /** * Get a global scope registered with the model. * - * @param Scope|string $scope - * + * @param Scope|string $scope * @return Scope|Closure|null */ public static function getGlobalScope($scope) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HasPassword.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HasPassword.php index 1a938c144..194efa8cf 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HasPassword.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HasPassword.php @@ -6,12 +6,13 @@ use LdapRecord\ConnectionException; use LdapRecord\LdapRecordException; use LdapRecord\Models\Attributes\Password; +/** @mixin \LdapRecord\Models\Model */ trait HasPassword { /** * Set the password on the user. * - * @param string|array $password + * @param string|array $password * * @throws ConnectionException */ @@ -48,7 +49,7 @@ trait HasPassword /** * Alias for setting the password on the user. * - * @param string|array $password + * @param string|array $password * * @throws ConnectionException */ @@ -106,10 +107,9 @@ trait HasPassword /** * Set the changed password. * - * @param string $oldPassword - * @param string $newPassword - * @param string $attribute - * + * @param string $oldPassword + * @param string $newPassword + * @param string $attribute * @return void */ protected function setChangedPassword($oldPassword, $newPassword, $attribute) @@ -136,9 +136,8 @@ trait HasPassword /** * Set the password on the model. * - * @param string $password - * @param string $attribute - * + * @param string $password + * @param string $attribute * @return void */ protected function setPassword($password, $attribute) @@ -155,10 +154,9 @@ trait HasPassword /** * Encode / hash the given password. * - * @param string $method - * @param string $password - * @param string $salt - * + * @param string $method + * @param string $password + * @param string $salt * @return string * * @throws LdapRecordException @@ -203,8 +201,7 @@ trait HasPassword /** * Attempt to retrieve the password's salt. * - * @param string $method - * + * @param string $method * @return string|null */ public function getPasswordSalt($method) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HasRelationships.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HasRelationships.php index a8a5cacf2..87c0a7cc8 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HasRelationships.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HasRelationships.php @@ -5,6 +5,7 @@ namespace LdapRecord\Models\Concerns; use LdapRecord\Models\Relations\HasMany; use LdapRecord\Models\Relations\HasManyIn; use LdapRecord\Models\Relations\HasOne; +use LdapRecord\Models\Relations\Relation; use LdapRecord\Support\Arr; trait HasRelationships @@ -12,10 +13,9 @@ trait HasRelationships /** * Returns a new has one relationship. * - * @param mixed $related - * @param string $relationKey - * @param string $foreignKey - * + * @param mixed $related + * @param string $relationKey + * @param string $foreignKey * @return HasOne */ public function hasOne($related, $relationKey, $foreignKey = 'dn') @@ -26,10 +26,9 @@ trait HasRelationships /** * Returns a new has many relationship. * - * @param mixed $related - * @param string $relationKey - * @param string $foreignKey - * + * @param mixed $related + * @param string $relationKey + * @param string $foreignKey * @return HasMany */ public function hasMany($related, $relationKey, $foreignKey = 'dn') @@ -40,10 +39,9 @@ trait HasRelationships /** * Returns a new has many in relationship. * - * @param mixed $related - * @param string $relationKey - * @param string $foreignKey - * + * @param mixed $related + * @param string $relationKey + * @param string $foreignKey * @return HasManyIn */ public function hasManyIn($related, $relationKey, $foreignKey = 'dn') @@ -51,6 +49,29 @@ trait HasRelationships return new HasManyIn($this->newQuery(), $this, $related, $relationKey, $foreignKey, $this->guessRelationshipName()); } + /** + * Get a relationship by its name. + * + * @param string $relationName + * @return Relation|null + */ + public function getRelation($relationName) + { + if (! method_exists($this, $relationName)) { + return; + } + + if (! $relation = $this->{$relationName}()) { + return; + } + + if (! $relation instanceof Relation) { + return; + } + + return $relation; + } + /** * Get the relationships name. * diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HasScopes.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HasScopes.php index 6c97cf925..cb227fecc 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HasScopes.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HasScopes.php @@ -2,6 +2,7 @@ namespace LdapRecord\Models\Concerns; +/** @mixin \LdapRecord\Models\Model */ trait HasScopes { /** diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HidesAttributes.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HidesAttributes.php index 9cc210057..ecd328dab 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HidesAttributes.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/HidesAttributes.php @@ -6,6 +6,8 @@ namespace LdapRecord\Models\Concerns; * @author Taylor Otwell * * @see https://laravel.com + * + * @mixin \LdapRecord\Models\Model */ trait HidesAttributes { @@ -38,8 +40,7 @@ trait HidesAttributes /** * Set the hidden attributes for the model. * - * @param array $hidden - * + * @param array $hidden * @return $this */ public function setHidden(array $hidden) @@ -52,8 +53,7 @@ trait HidesAttributes /** * Add hidden attributes for the model. * - * @param array|string|null $attributes - * + * @param array|string|null $attributes * @return void */ public function addHidden($attributes = null) @@ -79,8 +79,7 @@ trait HidesAttributes /** * Set the visible attributes for the model. * - * @param array $visible - * + * @param array $visible * @return $this */ public function setVisible(array $visible) @@ -93,8 +92,7 @@ trait HidesAttributes /** * Add visible attributes for the model. * - * @param array|string|null $attributes - * + * @param array|string|null $attributes * @return void */ public function addVisible($attributes = null) @@ -108,8 +106,7 @@ trait HidesAttributes /** * Make the given, typically hidden, attributes visible. * - * @param array|string $attributes - * + * @param array|string $attributes * @return $this */ public function makeVisible($attributes) @@ -126,8 +123,7 @@ trait HidesAttributes /** * Make the given, typically visible, attributes hidden. * - * @param array|string $attributes - * + * @param array|string $attributes * @return $this */ public function makeHidden($attributes) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/SerializesAndRestoresPropertyValues.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/SerializesAndRestoresPropertyValues.php new file mode 100644 index 000000000..cf550c749 --- /dev/null +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/SerializesAndRestoresPropertyValues.php @@ -0,0 +1,47 @@ +originalToArray(); + } + + if ($property === 'attributes') { + return $this->attributesToArray(); + } + + return $value; + } + + /** + * Get the unserialized property value after deserialization. + * + * @param string $property + * @param mixed $value + * @return mixed + */ + protected function getUnserializedPropertyValue($property, $value) + { + if ($property === 'original') { + return $this->arrayToOriginal($value); + } + + if ($property === 'attributes') { + return $this->arrayToAttributes($value); + } + + return $value; + } +} diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/SerializesProperties.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/SerializesProperties.php new file mode 100644 index 000000000..91f4bcfe3 --- /dev/null +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Concerns/SerializesProperties.php @@ -0,0 +1,143 @@ +getProperties(); + + foreach ($properties as $property) { + $property->setValue($this, $this->getSerializedPropertyValue( + $property->getName(), + $this->getPropertyValue($property) + )); + } + + return array_values(array_filter(array_map(function ($p) { + return $p->isStatic() ? null : $p->getName(); + }, $properties))); + } + + /** + * Restore the attributes after serialization. + * + * @return void + */ + public function __wakeup() + { + foreach ((new ReflectionClass($this))->getProperties() as $property) { + if ($property->isStatic()) { + continue; + } + + $property->setValue($this, $this->getUnserializedPropertyValue( + $property->getName(), + $this->getPropertyValue($property) + )); + } + } + + /** + * Prepare the model for serialization. + * + * @return array + */ + public function __serialize() + { + $values = []; + + $properties = (new ReflectionClass($this))->getProperties(); + + $class = get_class($this); + + foreach ($properties as $property) { + if ($property->isStatic()) { + continue; + } + + $property->setAccessible(true); + + if (! $property->isInitialized($this)) { + continue; + } + + $name = $property->getName(); + + if ($property->isPrivate()) { + $name = "\0{$class}\0{$name}"; + } elseif ($property->isProtected()) { + $name = "\0*\0{$name}"; + } + + $values[$name] = $this->getSerializedPropertyValue( + $property->getName(), + $this->getPropertyValue($property) + ); + } + + return $values; + } + + /** + * Restore the model after serialization. + * + * @param array $values + * @return void + */ + public function __unserialize(array $values) + { + $properties = (new ReflectionClass($this))->getProperties(); + + $class = get_class($this); + + foreach ($properties as $property) { + if ($property->isStatic()) { + continue; + } + + $name = $property->getName(); + + if ($property->isPrivate()) { + $name = "\0{$class}\0{$name}"; + } elseif ($property->isProtected()) { + $name = "\0*\0{$name}"; + } + + if (! array_key_exists($name, $values)) { + continue; + } + + $property->setAccessible(true); + + $property->setValue( + $this, + $this->getUnserializedPropertyValue($property->getName(), $values[$name]) + ); + } + } + + /** + * Get the property value for the given property. + * + * @param ReflectionProperty $property + * @return mixed + */ + protected function getPropertyValue(ReflectionProperty $property) + { + $property->setAccessible(true); + + return $property->getValue($this); + } +} diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/DetectsResetIntegers.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/DetectsResetIntegers.php index 8712ef755..7b8d1830e 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/DetectsResetIntegers.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/DetectsResetIntegers.php @@ -11,8 +11,7 @@ trait DetectsResetIntegers * LDAP attributes to instruct the server to reset the * value to an 'unset' or 'cleared' state. * - * @param mixed $value - * + * @param mixed $value * @return bool */ protected function valueIsResetInteger($value) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/DirectoryServer/Entry.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/DirectoryServer/Entry.php index 1bf832587..a67200e94 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/DirectoryServer/Entry.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/DirectoryServer/Entry.php @@ -3,8 +3,9 @@ namespace LdapRecord\Models\DirectoryServer; use LdapRecord\Models\Model; +use LdapRecord\Models\Types\DirectoryServer; -class Entry extends Model +class Entry extends Model implements DirectoryServer { /** * The attribute key that contains the models object GUID. diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Events/Event.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Events/Event.php index 20de0b7a6..8dbd1d29a 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Events/Event.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Events/Event.php @@ -16,7 +16,7 @@ abstract class Event /** * Constructor. * - * @param Model $model + * @param Model $model */ public function __construct(Model $model) { diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Events/Renaming.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Events/Renaming.php index 83427ca1a..5e7be97d7 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Events/Renaming.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Events/Renaming.php @@ -23,9 +23,9 @@ class Renaming extends Event /** * Constructor. * - * @param Model $model - * @param string $rdn - * @param string $newParentDn + * @param Model $model + * @param string $rdn + * @param string $newParentDn */ public function __construct(Model $model, $rdn, $newParentDn) { diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/FreeIPA/Entry.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/FreeIPA/Entry.php index 7fdda9c86..be6322b15 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/FreeIPA/Entry.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/FreeIPA/Entry.php @@ -44,8 +44,7 @@ class Entry extends BaseEntry implements FreeIPA /** * Create a new query builder. * - * @param Connection $connection - * + * @param Connection $connection * @return FreeIpaBuilder */ public function newQueryBuilder(Connection $connection) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/FreeIPA/Scopes/AddEntryUuidToSelects.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/FreeIPA/Scopes/AddEntryUuidToSelects.php index 039c05e4f..581b5beed 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/FreeIPA/Scopes/AddEntryUuidToSelects.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/FreeIPA/Scopes/AddEntryUuidToSelects.php @@ -11,9 +11,8 @@ class AddEntryUuidToSelects implements Scope /** * Add the entry UUID to the selected attributes. * - * @param Builder $query - * @param Model $model - * + * @param Builder $query + * @param Model $model * @return void */ public function apply(Builder $query, Model $model) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Model.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Model.php index 2e11696b4..932c1a3b1 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Model.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Model.php @@ -11,8 +11,6 @@ use LdapRecord\Container; use LdapRecord\EscapesValues; use LdapRecord\Models\Attributes\DistinguishedName; use LdapRecord\Models\Attributes\Guid; -use LdapRecord\Models\Events\Renamed; -use LdapRecord\Models\Events\Renaming; use LdapRecord\Query\Model\Builder; use LdapRecord\Support\Arr; use UnexpectedValueException; @@ -27,6 +25,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable use Concerns\HasGlobalScopes; use Concerns\HidesAttributes; use Concerns\HasRelationships; + use Concerns\SerializesProperties; /** * Indicates if the model exists in the directory. @@ -115,7 +114,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Constructor. * - * @param array $attributes + * @param array $attributes */ public function __construct(array $attributes = []) { @@ -163,9 +162,8 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Handle dynamic method calls into the model. * - * @param string $method - * @param array $parameters - * + * @param string $method + * @param array $parameters * @return mixed */ public function __call($method, $parameters) @@ -180,9 +178,8 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Handle dynamic static method calls into the method. * - * @param string $method - * @param array $parameters - * + * @param string $method + * @param array $parameters * @return mixed */ public static function __callStatic($method, $parameters) @@ -203,8 +200,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Set the models distinguished name. * - * @param string $dn - * + * @param string $dn * @return $this */ public function setDn($dn) @@ -217,8 +213,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * A mutator for setting the models distinguished name. * - * @param string $dn - * + * @param string $dn * @return $this */ public function setDnAttribute($dn) @@ -229,8 +224,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * A mutator for setting the models distinguished name. * - * @param string $dn - * + * @param string $dn * @return $this */ public function setDistinguishedNameAttribute($dn) @@ -261,8 +255,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Set the connection associated with the model. * - * @param string $name - * + * @param string $name * @return $this */ public function setConnection($name) @@ -272,11 +265,21 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable return $this; } + /** + * Make a new model instance. + * + * @param array $attributes + * @return static + */ + public static function make($attributes = []) + { + return new static($attributes); + } + /** * Begin querying the model on a given connection. * - * @param string|null $connection - * + * @param string|null $connection * @return Builder */ public static function on($connection = null) @@ -291,8 +294,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Get all the models from the directory. * - * @param array|mixed $attributes - * + * @param array|mixed $attributes * @return Collection|static[] */ public static function all($attributes = ['*']) @@ -301,15 +303,45 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable } /** - * Make a new model instance. + * Get the RootDSE (AD schema) record from the directory. * - * @param array $attributes + * @param string|null $connection + * @return Model * - * @return static + * @throws \LdapRecord\Models\ModelNotFoundException */ - public static function make($attributes = []) + public static function getRootDse($connection = null) { - return new static($attributes); + $model = static::getRootDseModel(); + + return $model::on($connection ?? (new $model)->getConnectionName()) + ->in(null) + ->read() + ->whereHas('objectclass') + ->firstOrFail(); + } + + /** + * Get the root DSE model. + * + * @return class-string + */ + protected static function getRootDseModel() + { + $instance = (new static); + + switch (true) { + case $instance instanceof Types\ActiveDirectory: + return ActiveDirectory\Entry::class; + case $instance instanceof Types\DirectoryServer: + return OpenLDAP\Entry::class; + case $instance instanceof Types\OpenLDAP: + return OpenLDAP\Entry::class; + case $instance instanceof Types\FreeIPA: + return FreeIPA\Entry::class; + default: + return Entry::class; + } } /** @@ -349,8 +381,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Create a new query builder. * - * @param Connection $connection - * + * @param Connection $connection * @return Builder */ public function newQueryBuilder(Connection $connection) @@ -361,8 +392,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Create a new model instance. * - * @param array $attributes - * + * @param array $attributes * @return static */ public function newInstance(array $attributes = []) @@ -373,8 +403,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Resolve a connection instance. * - * @param string|null $connection - * + * @param string|null $connection * @return Connection */ public static function resolveConnection($connection = null) @@ -405,8 +434,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Set the connection container. * - * @param Container $container - * + * @param Container $container * @return void */ public static function setConnectionContainer(Container $container) @@ -427,8 +455,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Register the query scopes for this builder instance. * - * @param Builder $builder - * + * @param Builder $builder * @return Builder */ public function registerModelScopes($builder) @@ -443,8 +470,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Register the global model scopes. * - * @param Builder $builder - * + * @param Builder $builder * @return Builder */ public function registerGlobalScopes($builder) @@ -459,8 +485,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Apply the model object class scopes to the given builder instance. * - * @param Builder $query - * + * @param Builder $query * @return void */ public function applyObjectClassScopes(Builder $query) @@ -483,10 +508,9 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Returns a new batch modification. * - * @param string|null $attribute - * @param string|int|null $type - * @param array $values - * + * @param string|null $attribute + * @param string|int|null $type + * @param array $values * @return BatchModification */ public function newBatchModification($attribute = null, $type = null, $values = []) @@ -497,8 +521,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Returns a new collection with the specified items. * - * @param mixed $items - * + * @param mixed $items * @return Collection */ public function newCollection($items = []) @@ -509,9 +532,8 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Dynamically retrieve attributes on the object. * - * @param mixed $key - * - * @return bool + * @param string $key + * @return mixed */ public function __get($key) { @@ -521,9 +543,8 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Dynamically set attributes on the object. * - * @param mixed $key - * @param mixed $value - * + * @param string $key + * @param mixed $value * @return $this */ public function __set($key, $value) @@ -534,8 +555,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Determine if the given offset exists. * - * @param string $offset - * + * @param string $offset * @return bool */ #[\ReturnTypeWillChange] @@ -547,8 +567,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Get the value for a given offset. * - * @param string $offset - * + * @param string $offset * @return mixed */ #[\ReturnTypeWillChange] @@ -560,9 +579,8 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Set the value at the given offset. * - * @param string $offset - * @param mixed $value - * + * @param string $offset + * @param mixed $value * @return void */ #[\ReturnTypeWillChange] @@ -574,8 +592,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Unset the value at the given offset. * - * @param string $offset - * + * @param string $offset * @return void */ #[\ReturnTypeWillChange] @@ -587,8 +604,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Determine if an attribute exists on the model. * - * @param string $key - * + * @param string $key * @return bool */ public function __isset($key) @@ -599,8 +615,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Unset an attribute on the model. * - * @param string $key - * + * @param string $key * @return void */ public function __unset($key) @@ -630,26 +645,36 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable } /** - * Converts extra attributes for JSON serialization. - * - * @param array $attributes + * Convert the attributes for JSON serialization. * + * @param array $attributes * @return array */ protected function convertAttributesForJson(array $attributes = []) { - // If the model has a GUID set, we need to convert - // it due to it being in binary. Otherwise we'll - // receive a JSON serialization exception. - if ($this->hasAttribute($this->guidKey)) { - return array_replace($attributes, [ - $this->guidKey => [$this->getConvertedGuid()], - ]); + // If the model has a GUID set, we need to convert it to its + // string format, due to it being in binary. Otherwise + // we will receive a JSON serialization exception. + if (isset($attributes[$this->guidKey])) { + $attributes[$this->guidKey] = [$this->getConvertedGuid( + Arr::first($attributes[$this->guidKey]) + )]; } return $attributes; } + /** + * Convert the attributes from JSON serialization. + * + * @param array $attributes + * @return array + */ + protected function convertAttributesFromJson(array $attributes = []) + { + return $attributes; + } + /** * Reload a fresh model instance from the directory. * @@ -667,8 +692,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Determine if two models have the same distinguished name and belong to the same connection. * - * @param Model|null $model - * + * @param Model|null $model * @return bool */ public function is($model) @@ -681,8 +705,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Determine if two models are not the same. * - * @param Model|null $model - * + * @param Model|null $model * @return bool */ public function isNot($model) @@ -693,8 +716,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Hydrate a new collection of models from search results. * - * @param array $records - * + * @param array $records * @return Collection */ public function hydrate($records) @@ -709,8 +731,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Converts the current model into the given model. * - * @param Model $into - * + * @param Model $into * @return Model */ public function convert(self $into) @@ -760,8 +781,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Set the models batch modifications. * - * @param array $modifications - * + * @param array $modifications * @return $this */ public function setModifications(array $modifications = []) @@ -778,8 +798,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Adds a batch modification to the model. * - * @param array|BatchModification $mod - * + * @param array|BatchModification $mod * @return $this * * @throws InvalidArgumentException @@ -824,8 +843,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Get the name of the model, or the given DN. * - * @param string|null $dn - * + * @param string|null $dn * @return string|null */ public function getName($dn = null) @@ -836,8 +854,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Get the head attribute of the model, or the given DN. * - * @param string|null $dn - * + * @param string|null $dn * @return string|null */ public function getHead($dn = null) @@ -849,7 +866,6 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable * Get the RDN of the model, of the given DN. * * @param string|null - * * @return string|null */ public function getRdn($dn = null) @@ -861,7 +877,6 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable * Get the parent distinguished name of the model, or the given DN. * * @param string|null - * * @return string|null */ public function getParentDn($dn = null) @@ -872,8 +887,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Create a new Distinguished Name object. * - * @param string|null $dn - * + * @param string|null $dn * @return DistinguishedName */ public function newDn($dn = null) @@ -910,28 +924,58 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable */ public function getObjectClasses() { - return $this->getAttribute('objectclass') ?: []; + return $this->getAttribute('objectclass', static::$objectClasses); } /** * Get the model's string GUID. * + * @param string|null $guid * @return string|null */ - public function getConvertedGuid() + public function getConvertedGuid($guid = null) { try { - return (string) new Guid($this->getObjectGuid()); + return (string) $this->newObjectGuid( + $guid ?? $this->getObjectGuid() + ); } catch (InvalidArgumentException $e) { return; } } + /** + * Get the model's binary GUID. + * + * @param string|null $guid + * @return string|null + */ + public function getBinaryGuid($guid = null) + { + try { + return $this->newObjectGuid( + $guid ?? $this->getObjectGuid() + )->getBinary(); + } catch (InvalidArgumentException $e) { + return; + } + } + + /** + * Make a new object Guid instance. + * + * @param string $value + * @return Guid + */ + protected function newObjectGuid($value) + { + return new Guid($value); + } + /** * Determine if the current model is a direct descendant of the given. * - * @param static|string $parent - * + * @param static|string $parent * @return bool */ public function isChildOf($parent) @@ -944,8 +988,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Determine if the current model is a direct ascendant of the given. * - * @param static|string $child - * + * @param static|string $child * @return bool */ public function isParentOf($child) @@ -958,8 +1001,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Determine if the current model is a descendant of the given. * - * @param static|string $model - * + * @param static|string $model * @return bool */ public function isDescendantOf($model) @@ -970,8 +1012,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Determine if the current model is a ancestor of the given. * - * @param static|string $model - * + * @param static|string $model * @return bool */ public function isAncestorOf($model) @@ -982,9 +1023,8 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Determines if the DN is inside of the parent DN. * - * @param static|string $dn - * @param static|string $parentDn - * + * @param static|string $dn + * @param static|string $parentDn * @return bool */ protected function dnIsInside($dn, $parentDn) @@ -997,8 +1037,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Set the base DN of where the model should be created in. * - * @param static|string $dn - * + * @param static|string $dn * @return $this */ public function inside($dn) @@ -1011,8 +1050,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Save the model to the directory without raising any events. * - * @param array $attributes - * + * @param array $attributes * @return void * * @throws \LdapRecord\LdapRecordException @@ -1027,8 +1065,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Save the model to the directory. * - * @param array $attributes The attributes to update or create for the current entry. - * + * @param array $attributes The attributes to update or create for the current entry. * @return void * * @throws \LdapRecord\LdapRecordException @@ -1037,11 +1074,13 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable { $this->fill($attributes); - $this->fireModelEvent(new Events\Saving($this)); + $this->dispatch('saving'); $this->exists ? $this->performUpdate() : $this->performInsert(); - $this->fireModelEvent(new Events\Saved($this)); + $this->dispatch('saved'); + + $this->modifications = []; $this->in = null; } @@ -1071,7 +1110,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable $this->setDn($this->getCreatableDn()); } - $this->fireModelEvent(new Events\Creating($this)); + $this->dispatch('creating'); // Here we perform the insert of new object in the directory, // but filter out any empty attributes before sending them @@ -1079,7 +1118,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable // attributes have been given empty or null values. $query->insert($this->getDn(), array_filter($this->getAttributes())); - $this->fireModelEvent(new Events\Created($this)); + $this->dispatch('created'); $this->syncOriginal(); @@ -1101,22 +1140,19 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable return; } - $this->fireModelEvent(new Events\Updating($this)); + $this->dispatch('updating'); $this->newQuery()->update($this->dn, $modifications); - $this->fireModelEvent(new Events\Updated($this)); + $this->dispatch('updated'); $this->syncOriginal(); - - $this->modifications = []; } /** * Create the model in the directory. * - * @param array $attributes The attributes for the new entry. - * + * @param array $attributes The attributes for the new entry. * @return Model * * @throws \LdapRecord\LdapRecordException @@ -1133,9 +1169,8 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Create an attribute on the model. * - * @param string $attribute The attribute to create - * @param mixed $value The value of the new attribute - * + * @param string $attribute The attribute to create + * @param mixed $value The value of the new attribute * @return void * * @throws ModelDoesNotExistException @@ -1143,18 +1178,21 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable */ public function createAttribute($attribute, $value) { - $this->requireExistence(); + $this->assertExists(); + + $this->dispatch(['saving', 'updating']); $this->newQuery()->insertAttributes($this->dn, [$attribute => (array) $value]); $this->addAttributeValue($attribute, $value); + + $this->dispatch(['updated', 'saved']); } /** * Update the model. * - * @param array $attributes The attributes to update for the current entry. - * + * @param array $attributes The attributes to update for the current entry. * @return void * * @throws ModelDoesNotExistException @@ -1162,7 +1200,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable */ public function update(array $attributes = []) { - $this->requireExistence(); + $this->assertExists(); $this->save($attributes); } @@ -1170,9 +1208,8 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Update the model attribute with the specified value. * - * @param string $attribute The attribute to modify - * @param mixed $value The new value for the attribute - * + * @param string $attribute The attribute to modify + * @param mixed $value The new value for the attribute * @return void * * @throws ModelDoesNotExistException @@ -1180,19 +1217,22 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable */ public function updateAttribute($attribute, $value) { - $this->requireExistence(); + $this->assertExists(); + + $this->dispatch(['saving', 'updating']); $this->newQuery()->updateAttributes($this->dn, [$attribute => (array) $value]); $this->addAttributeValue($attribute, $value); + + $this->dispatch(['updated', 'saved']); } /** * Destroy the models for the given distinguished names. * - * @param Collection|array|string $dns - * @param bool $recursive - * + * @param Collection|array|string $dns + * @param bool $recursive * @return int * * @throws \LdapRecord\LdapRecordException @@ -1201,11 +1241,17 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable { $count = 0; - $dns = is_string($dns) ? (array) $dns : $dns; - $instance = new static(); - foreach ($dns as $dn) { + if ($dns instanceof Collection) { + $dns = $dns->modelDns()->toArray(); + } + + // Here we are iterating through each distinguished name and locating + // the associated model. While it's more resource intensive, we must + // do this in case of leaf nodes being given alongside any parent + // node, ensuring they can be deleted inside of the directory. + foreach ((array) $dns as $dn) { if (! $model = $instance->find($dn)) { continue; } @@ -1224,8 +1270,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable * Throws a ModelNotFoundException if the current model does * not exist or does not contain a distinguished name. * - * @param bool $recursive Whether to recursively delete leaf nodes (models that are children). - * + * @param bool $recursive Whether to recursively delete leaf nodes (models that are children). * @return void * * @throws ModelDoesNotExistException @@ -1233,9 +1278,9 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable */ public function delete($recursive = false) { - $this->requireExistence(); + $this->assertExists(); - $this->fireModelEvent(new Events\Deleting($this)); + $this->dispatch('deleting'); if ($recursive) { $this->deleteLeafNodes(); @@ -1248,7 +1293,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable // developers can hook in and run further operations. $this->exists = false; - $this->fireModelEvent(new Events\Deleted($this)); + $this->dispatch('deleted'); } /** @@ -1263,15 +1308,15 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable $this->newQueryWithoutScopes() ->in($this->dn) ->listing() - ->chunk(250, function ($models) { - $models->each->delete($recursive = true); + ->each(function (Model $model) { + $model->delete($recursive = true); }); } /** * Delete an attribute on the model. * - * @param string|array $attributes The attribute(s) to delete + * @param string|array $attributes The attribute(s) to delete * * Delete specific values in attributes: * @@ -1280,7 +1325,6 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable * Delete an entire attribute: * * ["memberuid" => []] - * * @return void * * @throws ModelDoesNotExistException @@ -1288,10 +1332,12 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable */ public function deleteAttribute($attributes) { - $this->requireExistence(); + $this->assertExists(); $attributes = $this->makeDeletableAttributes($attributes); + $this->dispatch(['saving', 'updating']); + $this->newQuery()->deleteAttributes($this->dn, $attributes); foreach ($attributes as $attribute => $value) { @@ -1311,14 +1357,15 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable } } + $this->dispatch(['updated', 'saved']); + $this->syncOriginal(); } /** * Make a deletable attribute array. * - * @param string|array $attributes - * + * @param string|array $attributes * @return array */ protected function makeDeletableAttributes($attributes) @@ -1339,9 +1386,8 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable * * For example: $user->move($ou); * - * @param static|string $newParentDn The new parent of the current model. - * @param bool $deleteOldRdn Whether to delete the old models relative distinguished name once renamed / moved. - * + * @param static|string $newParentDn The new parent of the current model. + * @param bool $deleteOldRdn Whether to delete the old models relative distinguished name once renamed / moved. * @return void * * @throws UnexpectedValueException @@ -1350,7 +1396,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable */ public function move($newParentDn, $deleteOldRdn = true) { - $this->requireExistence(); + $this->assertExists(); if (! $rdn = $this->getRdn()) { throw new UnexpectedValueException('Current model does not contain an RDN to move.'); @@ -1362,10 +1408,9 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Rename the model to a new RDN and new parent. * - * @param string $rdn The models new relative distinguished name. Example: "cn=JohnDoe" - * @param static|string|null $newParentDn The models new parent distinguished name (if moving). Leave this null if you are only renaming. Example: "ou=MovedUsers,dc=acme,dc=org" - * @param bool|true $deleteOldRdn Whether to delete the old models relative distinguished name once renamed / moved. - * + * @param string $rdn The models new relative distinguished name. Example: "cn=JohnDoe" + * @param static|string|null $newParentDn The models new parent distinguished name (if moving). Leave this null if you are only renaming. Example: "ou=MovedUsers,dc=acme,dc=org" + * @param bool|true $deleteOldRdn Whether to delete the old models relative distinguished name once renamed / moved. * @return void * * @throws ModelDoesNotExistException @@ -1373,7 +1418,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable */ public function rename($rdn, $newParentDn = null, $deleteOldRdn = true) { - $this->requireExistence(); + $this->assertExists(); if ($newParentDn instanceof self) { $newParentDn = $newParentDn->getDn(); @@ -1400,7 +1445,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable $rdn = $this->getUpdateableRdn($rdn); } - $this->fireModelEvent(new Renaming($this, $rdn, $newParentDn)); + $this->dispatch('renaming', [$rdn, $newParentDn]); $this->newQuery()->rename($this->dn, $rdn, $newParentDn, $deleteOldRdn); @@ -1420,7 +1465,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable = $this->original[$modelNameAttribute] = [reset($map[$modelNameAttribute])]; - $this->fireModelEvent(new Renamed($this)); + $this->dispatch('renamed'); $this->wasRecentlyRenamed = true; } @@ -1428,8 +1473,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Get an updateable RDN for the model. * - * @param string $name - * + * @param string $name * @return string */ public function getUpdateableRdn($name) @@ -1440,9 +1484,8 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Get a distinguished name that is creatable for the model. * - * @param string|null $name - * @param string|null $attribute - * + * @param string|null $name + * @param string|null $attribute * @return string */ public function getCreatableDn($name = null, $attribute = null) @@ -1456,9 +1499,8 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Get a creatable (escaped) RDN for the model. * - * @param string|null $name - * @param string|null $attribute - * + * @param string|null $name + * @param string|null $attribute * @return string */ public function getCreatableRdn($name = null, $attribute = null) @@ -1485,8 +1527,7 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Determines if the given modification is valid. * - * @param mixed $mod - * + * @param mixed $mod * @return bool */ protected function isValidModification($mod) @@ -1528,11 +1569,25 @@ abstract class Model implements ArrayAccess, Arrayable, JsonSerializable /** * Throw an exception if the model does not exist. * + * @deprecated + * * @return void * * @throws ModelDoesNotExistException */ protected function requireExistence() + { + return $this->assertExists(); + } + + /** + * Throw an exception if the model does not exist. + * + * @return void + * + * @throws ModelDoesNotExistException + */ + protected function assertExists() { if (! $this->exists || is_null($this->dn)) { throw ModelDoesNotExistException::forModel($this); diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ModelDoesNotExistException.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ModelDoesNotExistException.php index 2dd2ba9bd..508414911 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ModelDoesNotExistException.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/ModelDoesNotExistException.php @@ -16,8 +16,7 @@ class ModelDoesNotExistException extends LdapRecordException /** * Create a new exception for the given model. * - * @param Model $model - * + * @param Model $model * @return ModelDoesNotExistException */ public static function forModel(Model $model) @@ -28,8 +27,7 @@ class ModelDoesNotExistException extends LdapRecordException /** * Set the model that does not exist. * - * @param Model $model - * + * @param Model $model * @return ModelDoesNotExistException */ public function setModel(Model $model) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/OpenLDAP/Entry.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/OpenLDAP/Entry.php index b7ad37a44..c11ca72d4 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/OpenLDAP/Entry.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/OpenLDAP/Entry.php @@ -34,8 +34,7 @@ class Entry extends BaseEntry implements OpenLDAP /** * Create a new query builder. * - * @param Connection $connection - * + * @param Connection $connection * @return OpenLdapBuilder */ public function newQueryBuilder(Connection $connection) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/OpenLDAP/Group.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/OpenLDAP/Group.php index 2d8d94e39..a9a682a06 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/OpenLDAP/Group.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/OpenLDAP/Group.php @@ -13,4 +13,16 @@ class Group extends Entry 'top', 'groupofuniquenames', ]; + + /** + * The members relationship. + * + * Retrieves members that are apart of the group. + * + * @return \LdapRecord\Models\Relations\HasMany + */ + public function members() + { + return $this->hasMany([static::class, User::class], 'memberUid'); + } } diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/OpenLDAP/Scopes/AddEntryUuidToSelects.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/OpenLDAP/Scopes/AddEntryUuidToSelects.php index 54376c2ba..780a633f3 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/OpenLDAP/Scopes/AddEntryUuidToSelects.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/OpenLDAP/Scopes/AddEntryUuidToSelects.php @@ -11,9 +11,8 @@ class AddEntryUuidToSelects implements Scope /** * Add the entry UUID to the selected attributes. * - * @param Builder $query - * @param Model $model - * + * @param Builder $query + * @param Model $model * @return void */ public function apply(Builder $query, Model $model) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/OpenLDAP/User.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/OpenLDAP/User.php index b37f39056..c8626de6d 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/OpenLDAP/User.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/OpenLDAP/User.php @@ -40,7 +40,7 @@ class User extends Entry implements Authenticatable /** * The groups relationship. * - * Retrieves groups that the user is apart of. + * Retrieve groups that the user is a part of. * * @return \LdapRecord\Models\Relations\HasMany */ diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Relations/HasMany.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Relations/HasMany.php index ae36720c2..583f81c30 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Relations/HasMany.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Relations/HasMany.php @@ -5,9 +5,9 @@ namespace LdapRecord\Models\Relations; use Closure; use LdapRecord\DetectsErrors; use LdapRecord\LdapRecordException; +use LdapRecord\Models\Collection; use LdapRecord\Models\Model; use LdapRecord\Models\ModelNotFoundException; -use LdapRecord\Query\Collection; class HasMany extends OneToMany { @@ -51,9 +51,8 @@ class HasMany extends OneToMany /** * Set the model and attribute to use for attaching / detaching. * - * @param Model $using - * @param string $usingKey - * + * @param Model $using + * @param string $usingKey * @return $this */ public function using(Model $using, $usingKey) @@ -67,8 +66,7 @@ class HasMany extends OneToMany /** * Set the pagination page size of the relation query. * - * @param int $pageSize - * + * @param int $pageSize * @return $this */ public function setPageSize($pageSize) @@ -81,8 +79,7 @@ class HasMany extends OneToMany /** * Paginate the relation using the given page size. * - * @param int $pageSize - * + * @param int $pageSize * @return Collection */ public function paginate($pageSize = 1000) @@ -93,8 +90,7 @@ class HasMany extends OneToMany /** * Paginate the relation using the page size once. * - * @param int $pageSize - * + * @param int $pageSize * @return Collection */ protected function paginateOnceUsing($pageSize) @@ -108,18 +104,67 @@ class HasMany extends OneToMany return $result; } + /** + * Execute a callback over each result while chunking. + * + * @param Closure $callback + * @param int $pageSize + * @return bool + */ + public function each(Closure $callback, $pageSize = 1000) + { + $this->chunk($pageSize, function ($results) use ($callback) { + foreach ($results as $key => $value) { + if ($callback($value, $key) === false) { + return false; + } + } + }); + } + /** * Chunk the relation results using the given callback. * - * @param int $pageSize - * @param Closure $callback - * - * @return void + * @param int $pageSize + * @param Closure $callback + * @param array $loaded + * @return bool */ public function chunk($pageSize, Closure $callback) { - $this->getRelationQuery()->chunk($pageSize, function ($entries) use ($callback) { - $callback($this->transformResults($entries)); + return $this->chunkRelation($pageSize, $callback); + } + + /** + * Execute the callback over chunks of relation results. + * + * @param int $pageSize + * @param Closure $callback + * @param array $loaded + * @return bool + */ + protected function chunkRelation($pageSize, Closure $callback, $loaded = []) + { + return $this->getRelationQuery()->chunk($pageSize, function (Collection $results) use ($pageSize, $callback, $loaded) { + $models = $this->transformResults($results)->when($this->recursive, function (Collection $models) use ($loaded) { + return $models->reject(function (Model $model) use ($loaded) { + return in_array($model->getDn(), $loaded); + }); + }); + + if ($callback($models) === false) { + return false; + } + + $models->when($this->recursive, function (Collection $models) use ($pageSize, $callback, $loaded) { + $models->each(function (Model $model) use ($pageSize, $callback, $loaded) { + if ($relation = $model->getRelation($this->relationName)) { + $loaded[] = $model->getDn(); + + return $relation->recursive()->chunkRelation($pageSize, $callback, $loaded); + } + }); + }); }); } @@ -168,8 +213,7 @@ class HasMany extends OneToMany /** * Attach a model to the relation. * - * @param Model|string $model - * + * @param Model|string $model * @return Model|string|false */ public function attach($model) @@ -184,8 +228,7 @@ class HasMany extends OneToMany /** * Build the attach callback. * - * @param Model|string $model - * + * @param Model|string $model * @return \Closure */ protected function buildAttachCallback($model) @@ -208,8 +251,7 @@ class HasMany extends OneToMany /** * Attach a collection of models to the parent instance. * - * @param iterable $models - * + * @param iterable $models * @return iterable */ public function attachMany($models) @@ -224,8 +266,7 @@ class HasMany extends OneToMany /** * Detach the model from the relation. * - * @param Model|string $model - * + * @param Model|string $model * @return Model|string|false */ public function detach($model) @@ -237,11 +278,29 @@ class HasMany extends OneToMany ); } + /** + * Detach the model or delete the parent if the relation is empty. + * + * @param Model|string $model + * @return void + */ + public function detachOrDeleteParent($model) + { + $count = $this->onceWithoutMerging(function () { + return $this->count(); + }); + + if ($count <= 1) { + return $this->getParent()->delete(); + } + + return $this->detach($model); + } + /** * Build the detach callback. * - * @param Model|string $model - * + * @param Model|string $model * @return \Closure */ protected function buildDetachCallback($model) @@ -264,8 +323,7 @@ class HasMany extends OneToMany /** * Get the attachable foreign value from the model. * - * @param Model|string $model - * + * @param Model|string $model * @return string */ protected function getAttachableForeignValue($model) @@ -282,8 +340,7 @@ class HasMany extends OneToMany /** * Get the foreign model by the given value, or fail. * - * @param string $model - * + * @param string $model * @return Model * * @throws ModelNotFoundException @@ -305,10 +362,9 @@ class HasMany extends OneToMany * * If a bypassable exception is encountered, the value will be returned. * - * @param callable $operation - * @param string|array $bypass - * @param mixed $value - * + * @param callable $operation + * @param string|array $bypass + * @param mixed $value * @return mixed * * @throws LdapRecordException @@ -341,4 +397,24 @@ class HasMany extends OneToMany }); }); } + + /** + * Detach all relation models or delete the model if its relation is empty. + * + * @return Collection + */ + public function detachAllOrDelete() + { + return $this->onceWithoutMerging(function () { + return $this->get()->each(function (Model $model) { + $relation = $model->getRelation($this->relationName); + + if ($relation && $relation->count() >= 1) { + $model->delete(); + } else { + $this->detach($model); + } + }); + }); + } } diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Relations/HasOne.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Relations/HasOne.php index 7bad4ab63..243cd2ed9 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Relations/HasOne.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Relations/HasOne.php @@ -25,8 +25,7 @@ class HasOne extends Relation /** * Attach a model instance to the parent model. * - * @param Model|string $model - * + * @param Model|string $model * @return Model|string * * @throws \LdapRecord\LdapRecordException diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Relations/OneToMany.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Relations/OneToMany.php index 6d14c8574..aa873b60b 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Relations/OneToMany.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Relations/OneToMany.php @@ -32,12 +32,12 @@ abstract class OneToMany extends Relation /** * Constructor. * - * @param Builder $query - * @param Model $parent - * @param string $related - * @param string $relationKey - * @param string $foreignKey - * @param string $relationName + * @param Builder $query + * @param Model $parent + * @param string $related + * @param string $relationKey + * @param string $foreignKey + * @param string $relationName */ public function __construct(Builder $query, Model $parent, $related, $relationKey, $foreignKey, $relationName) { @@ -49,8 +49,7 @@ abstract class OneToMany extends Relation /** * Set the relation to load with its parent. * - * @param Relation $relation - * + * @param Relation $relation * @return $this */ public function with(Relation $relation) @@ -63,8 +62,7 @@ abstract class OneToMany extends Relation /** * Whether to include recursive results. * - * @param bool $enable - * + * @param bool $enable * @return $this */ public function recursive($enable = true) @@ -100,8 +98,7 @@ abstract class OneToMany extends Relation /** * Execute the callback excluding the merged query result. * - * @param callable $callback - * + * @param callable $callback * @return mixed */ protected function onceWithoutMerging($callback) @@ -142,8 +139,7 @@ abstract class OneToMany extends Relation /** * Get the results for the models relation recursively. * - * @param string[] $loaded The distinguished names of models already loaded - * + * @param string[] $loaded The distinguished names of models already loaded * @return Collection */ protected function getRecursiveResults(array $loaded = []) @@ -172,15 +168,14 @@ abstract class OneToMany extends Relation /** * Get the recursive relation results for given model. * - * @param Model $model - * @param array $loaded - * + * @param Model $model + * @param array $loaded * @return Collection */ protected function getRecursiveRelationResults(Model $model, array $loaded) { - return method_exists($model, $this->relationName) - ? $model->{$this->relationName}()->getRecursiveResults($loaded) + return ($relation = $model->getRelation($this->relationName)) + ? $relation->getRecursiveResults($loaded) : $model->newCollection(); } } diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Relations/Relation.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Relations/Relation.php index 1b108fd91..31b0969c9 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Relations/Relation.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Relations/Relation.php @@ -2,6 +2,7 @@ namespace LdapRecord\Models\Relations; +use Closure; use LdapRecord\Models\Entry; use LdapRecord\Models\Model; use LdapRecord\Query\Collection; @@ -9,7 +10,8 @@ use LdapRecord\Query\Model\Builder; /** * @method bool exists($models = null) Determine if the relation contains all of the given models, or any models - * @method bool contains($models) Determine if any of the given models are contained in the relation + * @method bool contains($models) Determine if any of the given models are contained in the relation + * @method bool count() Retrieve the "count" result of the query. */ abstract class Relation { @@ -28,7 +30,7 @@ abstract class Relation protected $parent; /** - * The related models. + * The related model class names. * * @var array */ @@ -55,14 +57,28 @@ abstract class Relation */ protected $default = Entry::class; + /** + * The callback to use for resolving relation models. + * + * @var Closure + */ + protected static $modelResolver; + + /** + * The methods that should be passed along to a relation collection. + * + * @var string[] + */ + protected $passthru = ['count', 'exists', 'contains']; + /** * Constructor. * - * @param Builder $query - * @param Model $parent - * @param mixed $related - * @param string $relationKey - * @param string $foreignKey + * @param Builder $query + * @param Model $parent + * @param string|array $related + * @param string $relationKey + * @param string $foreignKey */ public function __construct(Builder $query, Model $parent, $related, $relationKey, $foreignKey) { @@ -72,20 +88,23 @@ abstract class Relation $this->relationKey = $relationKey; $this->foreignKey = $foreignKey; + static::$modelResolver = static::$modelResolver ?? function (array $modelObjectClasses, array $relationMap) { + return array_search($modelObjectClasses, $relationMap); + }; + $this->initRelation(); } /** * Handle dynamic method calls to the relationship. * - * @param string $method - * @param array $parameters - * + * @param string $method + * @param array $parameters * @return mixed */ public function __call($method, $parameters) { - if (in_array($method, ['exists', 'contains'])) { + if (in_array($method, $this->passthru)) { return $this->get('objectclass')->$method(...$parameters); } @@ -98,6 +117,45 @@ abstract class Relation return $result; } + /** + * Set the callback to use for resolving models from relation results. + * + * @param Closure $callback + * @return void + */ + public static function resolveModelsUsing(Closure $callback) + { + static::$modelResolver = $callback; + } + + /** + * Only return objects matching the related model's object classes. + * + * @return $this + */ + public function onlyRelated() + { + $relations = []; + + foreach ($this->related as $related) { + $relations[$related] = $related::$objectClasses; + } + + $relations = array_filter($relations); + + if (empty($relations)) { + return $this; + } + + $this->query->andFilter(function (Builder $query) use ($relations) { + foreach ($relations as $relation => $objectClasses) { + $query->whereIn('objectclass', $objectClasses); + } + }); + + return $this; + } + /** * Get the results of the relationship. * @@ -108,8 +166,7 @@ abstract class Relation /** * Execute the relationship query. * - * @param array|string $columns - * + * @param array|string $columns * @return Collection */ public function get($columns = ['*']) @@ -122,8 +179,7 @@ abstract class Relation * * If the query columns are empty, the given columns are applied. * - * @param array $columns - * + * @param array $columns * @return Collection */ protected function getResultsWithColumns($columns) @@ -138,8 +194,7 @@ abstract class Relation /** * Get the first result of the relationship. * - * @param array|string $columns - * + * @param array|string $columns * @return Model|null */ public function first($columns = ['*']) @@ -162,6 +217,21 @@ abstract class Relation return $this; } + /** + * Set the underlying query for the relation. + * + * @param Builder $query + * @return $this + */ + public function setQuery(Builder $query) + { + $this->query = $query; + + $this->initRelation(); + + return $this; + } + /** * Get the underlying query for the relation. * @@ -239,8 +309,7 @@ abstract class Relation /** * Get the foreign model by the given value. * - * @param string $value - * + * @param string $value * @return Model|null */ protected function getForeignModelByValue($value) @@ -253,8 +322,7 @@ abstract class Relation /** * Returns the escaped foreign key value for use in an LDAP filter from the model. * - * @param Model $model - * + * @param Model $model * @return string */ protected function getEscapedForeignValueFromModel(Model $model) @@ -277,8 +345,7 @@ abstract class Relation /** * Get the foreign key value from the model. * - * @param Model $model - * + * @param Model $model * @return string */ protected function getForeignValueFromModel(Model $model) @@ -291,9 +358,8 @@ abstract class Relation /** * Get the first attribute value from the model. * - * @param Model $model - * @param string $attribute - * + * @param Model $model + * @param string $attribute * @return string|null */ protected function getFirstAttributeValue(Model $model, $attribute) @@ -304,20 +370,21 @@ abstract class Relation /** * Transforms the results by converting the models into their related. * - * @param Collection $results - * + * @param Collection $results * @return Collection */ protected function transformResults(Collection $results) { - $related = []; + $relationMap = []; foreach ($this->related as $relation) { - $related[$relation] = $relation::$objectClasses; + $relationMap[$relation] = $this->normalizeObjectClasses( + $relation::$objectClasses + ); } - return $results->transform(function (Model $entry) use ($related) { - $model = $this->determineModelFromRelated($entry, $related); + return $results->transform(function (Model $entry) use ($relationMap) { + $model = $this->determineModelFromRelated($entry, $relationMap); return class_exists($model) ? $entry->convert(new $model()) : $entry; }); @@ -334,29 +401,33 @@ abstract class Relation } /** - * Determines the model from the given relations. + * Determines the model from the given relation map. * - * @param Model $model - * @param array $related - * - * @return string|bool + * @param Model $model + * @param array $relationMap + * @return class-string|bool */ - protected function determineModelFromRelated(Model $model, array $related) + protected function determineModelFromRelated(Model $model, array $relationMap) { // We must normalize all the related models object class // names to the same case so we are able to properly // determine the owning model from search results. - return array_search( - $this->normalizeObjectClasses($model->getObjectClasses()), - array_map([$this, 'normalizeObjectClasses'], $related) + $modelObjectClasses = $this->normalizeObjectClasses( + $model->getObjectClasses() + ); + + return call_user_func( + static::$modelResolver, + $modelObjectClasses, + $relationMap, + $model, ); } /** * Sort and normalize the object classes. * - * @param array $classes - * + * @param array $classes * @return array */ protected function normalizeObjectClasses($classes) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Scope.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Scope.php index 321cae357..f61cf686b 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Scope.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Scope.php @@ -9,9 +9,8 @@ interface Scope /** * Apply the scope to the given query. * - * @param Builder $query - * @param Model $model - * + * @param Builder $query + * @param Model $model * @return void */ public function apply(Builder $query, Model $model); diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Types/ActiveDirectory.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Types/ActiveDirectory.php index 61d21ef28..3edcf88c9 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Types/ActiveDirectory.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Types/ActiveDirectory.php @@ -23,7 +23,16 @@ interface ActiveDirectory extends TypeInterface /** * Returns the model's SID. * + * @param string|null $sid * @return string|null */ - public function getConvertedSid(); + public function getConvertedSid($sid = null); + + /** + * Returns the model's binary SID. + * + * @param string|null $sid + * @return string|null + */ + public function getBinarySid($sid = null); } diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Types/DirectoryServer.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Types/DirectoryServer.php new file mode 100644 index 000000000..f06216cd5 --- /dev/null +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Models/Types/DirectoryServer.php @@ -0,0 +1,8 @@ +chunk($count, function ($results) use ($callback) { + return $this->chunk($pageSize, function ($results) use ($callback) { foreach ($results as $key => $value) { if ($callback($value, $key) === false) { return false; } } - }); + }, $isCritical, $isolate); } /** * Chunk the results of a paginated LDAP query. * - * @param int $pageSize - * @param Closure $callback - * @param bool $isCritical - * + * @param int $pageSize + * @param Closure $callback + * @param bool $isCritical + * @param bool $isolate * @return bool */ - public function chunk($pageSize, Closure $callback, $isCritical = false) + public function chunk($pageSize, Closure $callback, $isCritical = false, $isolate = false) { $start = microtime(true); - $query = $this->getQuery(); + $chunk = function (Builder $query) use ($pageSize, $callback, $isCritical) { + $page = 1; - $page = 1; + foreach ($query->runChunk($this->getQuery(), $pageSize, $isCritical) as $chunk) { + if ($callback($this->process($chunk), $page) === false) { + return false; + } - foreach ($this->runChunk($query, $pageSize, $isCritical) as $chunk) { - if ($callback($this->process($chunk), $page) === false) { - return false; + $page++; } + }; - $page++; - } + $isolate ? $this->connection->isolate(function (Connection $replicate) use ($chunk) { + $chunk($this->clone()->setConnection($replicate)); + }) : $chunk($this); $this->logQuery($this, 'chunk', $this->getElapsedTime($start)); @@ -561,11 +549,10 @@ class Builder /** * Runs the chunk operation with the given filter. * - * @param string $filter - * @param int $perPage - * @param bool $isCritical - * - * @return array + * @param string $filter + * @param int $perPage + * @param bool $isCritical + * @return \Generator */ protected function runChunk($filter, $perPage, $isCritical) { @@ -574,11 +561,61 @@ class Builder }); } + /** + * Create a slice of the LDAP query into a page. + * + * @param int $page + * @param int $perPage + * @param string $orderBy + * @param string $orderByDir + * @return Slice + */ + public function slice($page = 1, $perPage = 100, $orderBy = 'cn', $orderByDir = 'asc') + { + $results = $this->forPage($page, $perPage, $orderBy, $orderByDir); + + $total = $this->controlsResponse[LDAP_CONTROL_VLVRESPONSE]['value']['count'] ?? 0; + + // Some LDAP servers seem to have an issue where the last result in a virtual + // list view will always be returned, regardless of the offset being larger + // than the result itself. In this case, we will manually return an empty + // response so that no objects are deceivingly included in the slice. + $objects = $page > max((int) ceil($total / $perPage), 1) + ? ($this instanceof ModelBuilder ? $this->model->newCollection() : []) + : $results; + + return new Slice($objects, $total, $perPage, $page); + } + + /** + * Get the results of a query for a given page. + * + * @param int $page + * @param int $perPage + * @param string $orderBy + * @param string $orderByDir + * @return Collection|array + */ + public function forPage($page = 1, $perPage = 100, $orderBy = 'cn', $orderByDir = 'asc') + { + if (! $this->hasOrderBy()) { + $this->orderBy($orderBy, $orderByDir); + } + + $this->addControl(LDAP_CONTROL_VLVREQUEST, true, [ + 'before' => 0, + 'after' => $perPage - 1, + 'offset' => ($page * $perPage) - $perPage + 1, + 'count' => 0, + ]); + + return $this->get(); + } + /** * Processes and converts the given LDAP results into models. * - * @param array $results - * + * @param array $results * @return array */ protected function process(array $results) @@ -595,8 +632,7 @@ class Builder /** * Flattens LDAP paged results into a single array. * - * @param array $pages - * + * @param array $pages * @return array */ protected function flattenPages(array $pages) @@ -615,9 +651,8 @@ class Builder /** * Get the cached response or execute and cache the callback value. * - * @param string $query - * @param Closure $callback - * + * @param string $query + * @param Closure $callback * @return mixed */ protected function getCachedResponse($query, Closure $callback) @@ -638,8 +673,7 @@ class Builder /** * Runs the query operation with the given filter. * - * @param string $filter - * + * @param string $filter * @return resource */ public function run($filter) @@ -668,8 +702,7 @@ class Builder /** * Parses the given LDAP resource by retrieving its entries. * - * @param resource $resource - * + * @param resource $resource * @return array */ public function parse($resource) @@ -708,13 +741,14 @@ class Builder /** * Returns the cache key. * - * @param string $query - * + * @param string $query * @return string */ protected function getCacheKey($query) { - $host = $this->connection->getLdapConnection()->getHost(); + $host = $this->connection->run(function (LdapInterface $ldap) { + return $ldap->getHost(); + }); $key = $host .$this->type @@ -730,8 +764,7 @@ class Builder /** * Returns the first entry in a search result. * - * @param array|string $columns - * + * @param array|string $columns * @return Model|null */ public function first($columns = ['*']) @@ -746,8 +779,7 @@ class Builder * * If no entry is found, an exception is thrown. * - * @param array|string $columns - * + * @param array|string $columns * @return Model|array * * @throws ObjectNotFoundException @@ -764,8 +796,7 @@ class Builder /** * Return the first entry in a result, or execute the callback. * - * @param Closure $callback - * + * @param Closure $callback * @return Model|mixed */ public function firstOr(Closure $callback) @@ -776,8 +807,7 @@ class Builder /** * Execute the query and get the first result if it's the sole matching record. * - * @param array|string $columns - * + * @param array|string $columns * @return Model|array * * @throws ObjectsNotFoundException @@ -821,8 +851,7 @@ class Builder /** * Execute the given callback if no rows exist for the current query. * - * @param Closure $callback - * + * @param Closure $callback * @return bool|mixed */ public function existsOr(Closure $callback) @@ -833,8 +862,8 @@ class Builder /** * Throws a not found exception. * - * @param string $query - * @param string $dn + * @param string $query + * @param string $dn * * @throws ObjectNotFoundException */ @@ -846,10 +875,9 @@ class Builder /** * Finds a record by the specified attribute and value. * - * @param string $attribute - * @param string $value - * @param array|string $columns - * + * @param string $attribute + * @param string $value + * @param array|string $columns * @return Model|static|null */ public function findBy($attribute, $value, $columns = ['*']) @@ -866,10 +894,9 @@ class Builder * * If no record is found an exception is thrown. * - * @param string $attribute - * @param string $value - * @param array|string $columns - * + * @param string $attribute + * @param string $value + * @param array|string $columns * @return Model * * @throws ObjectNotFoundException @@ -882,9 +909,8 @@ class Builder /** * Find many records by distinguished name. * - * @param array $dns - * @param array $columns - * + * @param string|array $dns + * @param array $columns * @return array|Collection */ public function findMany($dns, $columns = ['*']) @@ -895,7 +921,7 @@ class Builder $objects = []; - foreach ($dns as $dn) { + foreach ((array) $dns as $dn) { if (! is_null($object = $this->find($dn, $columns))) { $objects[] = $object; } @@ -907,10 +933,9 @@ class Builder /** * Finds many records by the specified attribute. * - * @param string $attribute - * @param array $values - * @param array $columns - * + * @param string $attribute + * @param array $values + * @param array $columns * @return Collection */ public function findManyBy($attribute, array $values = [], $columns = ['*']) @@ -927,9 +952,8 @@ class Builder /** * Finds a record by its distinguished name. * - * @param string|array $dn - * @param array|string $columns - * + * @param string|array $dn + * @param array|string $columns * @return Model|static|array|Collection|null */ public function find($dn, $columns = ['*']) @@ -950,9 +974,8 @@ class Builder * * Fails upon no records returned. * - * @param string $dn - * @param array|string $columns - * + * @param string $dn + * @param array|string $columns * @return Model|static * * @throws ObjectNotFoundException @@ -968,8 +991,7 @@ class Builder /** * Adds the inserted fields to query on the current LDAP connection. * - * @param array|string $columns - * + * @param array|string $columns * @return $this */ public function select($columns = ['*']) @@ -986,8 +1008,7 @@ class Builder /** * Add a new select column to the query. * - * @param array|mixed $column - * + * @param array|mixed $column * @return $this */ public function addSelect($column) @@ -1002,9 +1023,8 @@ class Builder /** * Add an order by control to the query. * - * @param string $attribute - * @param string $direction - * + * @param string $attribute + * @param string $direction * @return $this */ public function orderBy($attribute, $direction = 'asc') @@ -1017,8 +1037,7 @@ class Builder /** * Add an order by descending control to the query. * - * @param string $attribute - * + * @param string $attribute * @return $this */ public function orderByDesc($attribute) @@ -1026,11 +1045,20 @@ class Builder return $this->orderBy($attribute, 'desc'); } + /** + * Determine if the query has a sotr request control header. + * + * @return bool + */ + public function hasOrderBy() + { + return $this->hasControl(LDAP_CONTROL_SORTREQUEST); + } + /** * Adds a raw filter to the current query. * - * @param array|string $filters - * + * @param array|string $filters * @return $this */ public function rawFilter($filters = []) @@ -1047,8 +1075,7 @@ class Builder /** * Adds a nested 'and' filter to the current query. * - * @param Closure $closure - * + * @param Closure $closure * @return $this */ public function andFilter(Closure $closure) @@ -1063,8 +1090,7 @@ class Builder /** * Adds a nested 'or' filter to the current query. * - * @param Closure $closure - * + * @param Closure $closure * @return $this */ public function orFilter(Closure $closure) @@ -1079,8 +1105,7 @@ class Builder /** * Adds a nested 'not' filter to the current query. * - * @param Closure $closure - * + * @param Closure $closure * @return $this */ public function notFilter(Closure $closure) @@ -1095,12 +1120,11 @@ class Builder /** * Adds a where clause to the current query. * - * @param string|array $field - * @param string $operator - * @param string $value - * @param string $boolean - * @param bool $raw - * + * @param string|array $field + * @param string $operator + * @param string $value + * @param string $boolean + * @param bool $raw * @return $this * * @throws InvalidArgumentException @@ -1138,10 +1162,9 @@ class Builder /** * Prepare the value for being queried. * - * @param string $field - * @param string $value - * @param bool $raw - * + * @param string $field + * @param string $value + * @param bool $raw * @return string */ protected function prepareWhereValue($field, $value, $raw = false) @@ -1154,10 +1177,9 @@ class Builder * * Values given to this method are not escaped. * - * @param string|array $field - * @param string $operator - * @param string $value - * + * @param string|array $field + * @param string $operator + * @param string $value * @return $this */ public function whereRaw($field, $operator = null, $value = null) @@ -1168,9 +1190,8 @@ class Builder /** * Adds a 'where equals' clause to the current query. * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return $this */ public function whereEquals($field, $value) @@ -1181,9 +1202,8 @@ class Builder /** * Adds a 'where not equals' clause to the current query. * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return $this */ public function whereNotEquals($field, $value) @@ -1194,9 +1214,8 @@ class Builder /** * Adds a 'where approximately equals' clause to the current query. * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return $this */ public function whereApproximatelyEquals($field, $value) @@ -1207,8 +1226,7 @@ class Builder /** * Adds a 'where has' clause to the current query. * - * @param string $field - * + * @param string $field * @return $this */ public function whereHas($field) @@ -1219,8 +1237,7 @@ class Builder /** * Adds a 'where not has' clause to the current query. * - * @param string $field - * + * @param string $field * @return $this */ public function whereNotHas($field) @@ -1231,9 +1248,8 @@ class Builder /** * Adds a 'where contains' clause to the current query. * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return $this */ public function whereContains($field, $value) @@ -1244,9 +1260,8 @@ class Builder /** * Adds a 'where contains' clause to the current query. * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return $this */ public function whereNotContains($field, $value) @@ -1257,9 +1272,8 @@ class Builder /** * Query for entries that match any of the values provided for the given field. * - * @param string $field - * @param array $values - * + * @param string $field + * @param array $values * @return $this */ public function whereIn($field, array $values) @@ -1274,9 +1288,8 @@ class Builder /** * Adds a 'between' clause to the current query. * - * @param string $field - * @param array $values - * + * @param string $field + * @param array $values * @return $this */ public function whereBetween($field, array $values) @@ -1290,9 +1303,8 @@ class Builder /** * Adds a 'where starts with' clause to the current query. * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return $this */ public function whereStartsWith($field, $value) @@ -1303,9 +1315,8 @@ class Builder /** * Adds a 'where *not* starts with' clause to the current query. * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return $this */ public function whereNotStartsWith($field, $value) @@ -1316,9 +1327,8 @@ class Builder /** * Adds a 'where ends with' clause to the current query. * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return $this */ public function whereEndsWith($field, $value) @@ -1329,9 +1339,8 @@ class Builder /** * Adds a 'where *not* ends with' clause to the current query. * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return $this */ public function whereNotEndsWith($field, $value) @@ -1362,10 +1371,9 @@ class Builder /** * Add a server control to the query. * - * @param string $oid - * @param bool $isCritical - * @param mixed $value - * + * @param string $oid + * @param bool $isCritical + * @param mixed $value * @return $this */ public function addControl($oid, $isCritical = false, $value = null) @@ -1378,8 +1386,7 @@ class Builder /** * Determine if the server control exists on the query. * - * @param string $oid - * + * @param string $oid * @return bool */ public function hasControl($oid) @@ -1390,10 +1397,9 @@ class Builder /** * Adds an 'or where' clause to the current query. * - * @param array|string $field - * @param string|null $operator - * @param string|null $value - * + * @param array|string $field + * @param string|null $operator + * @param string|null $value * @return $this */ public function orWhere($field, $operator = null, $value = null) @@ -1406,10 +1412,9 @@ class Builder * * Values given to this method are not escaped. * - * @param string $field - * @param string $operator - * @param string $value - * + * @param string $field + * @param string $operator + * @param string $value * @return $this */ public function orWhereRaw($field, $operator = null, $value = null) @@ -1420,8 +1425,7 @@ class Builder /** * Adds an 'or where has' clause to the current query. * - * @param string $field - * + * @param string $field * @return $this */ public function orWhereHas($field) @@ -1432,8 +1436,7 @@ class Builder /** * Adds a 'where not has' clause to the current query. * - * @param string $field - * + * @param string $field * @return $this */ public function orWhereNotHas($field) @@ -1444,9 +1447,8 @@ class Builder /** * Adds an 'or where equals' clause to the current query. * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return $this */ public function orWhereEquals($field, $value) @@ -1457,9 +1459,8 @@ class Builder /** * Adds an 'or where not equals' clause to the current query. * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return $this */ public function orWhereNotEquals($field, $value) @@ -1470,9 +1471,8 @@ class Builder /** * Adds a 'or where approximately equals' clause to the current query. * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return $this */ public function orWhereApproximatelyEquals($field, $value) @@ -1483,9 +1483,8 @@ class Builder /** * Adds an 'or where contains' clause to the current query. * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return $this */ public function orWhereContains($field, $value) @@ -1496,9 +1495,8 @@ class Builder /** * Adds an 'or where *not* contains' clause to the current query. * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return $this */ public function orWhereNotContains($field, $value) @@ -1509,9 +1507,8 @@ class Builder /** * Adds an 'or where starts with' clause to the current query. * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return $this */ public function orWhereStartsWith($field, $value) @@ -1522,9 +1519,8 @@ class Builder /** * Adds an 'or where *not* starts with' clause to the current query. * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return $this */ public function orWhereNotStartsWith($field, $value) @@ -1535,9 +1531,8 @@ class Builder /** * Adds an 'or where ends with' clause to the current query. * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return $this */ public function orWhereEndsWith($field, $value) @@ -1548,9 +1543,8 @@ class Builder /** * Adds an 'or where *not* ends with' clause to the current query. * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return $this */ public function orWhereNotEndsWith($field, $value) @@ -1561,9 +1555,8 @@ class Builder /** * Adds a filter binding onto the current query. * - * @param string $type The type of filter to add. - * @param array $bindings The bindings of the filter. - * + * @param string $type The type of filter to add. + * @param array $bindings The bindings of the filter. * @return $this * * @throws InvalidArgumentException @@ -1591,8 +1584,7 @@ class Builder /** * Extract any missing required binding keys. * - * @param array $bindings - * + * @param array $bindings * @return array */ protected function missingBindingKeys($bindings) @@ -1704,8 +1696,7 @@ class Builder /** * Whether to mark the current query as nested. * - * @param bool $nested - * + * @param bool $nested * @return $this */ public function nested($nested = true) @@ -1720,9 +1711,8 @@ class Builder * * If flushing is enabled, the query cache will be flushed and then re-cached. * - * @param DateTimeInterface $until When to expire the query cache. - * @param bool $flush Whether to force-flush the query cache. - * + * @param DateTimeInterface $until When to expire the query cache. + * @param bool $flush Whether to force-flush the query cache. * @return $this */ public function cache(DateTimeInterface $until = null, $flush = false) @@ -1757,9 +1747,8 @@ class Builder /** * Insert an entry into the directory. * - * @param string $dn - * @param array $attributes - * + * @param string $dn + * @param array $attributes * @return bool * * @throws LdapRecordException @@ -1784,9 +1773,8 @@ class Builder /** * Create attributes on the entry in the directory. * - * @param string $dn - * @param array $attributes - * + * @param string $dn + * @param array $attributes * @return bool */ public function insertAttributes($dn, array $attributes) @@ -1799,9 +1787,8 @@ class Builder /** * Update the entry with the given modifications. * - * @param string $dn - * @param array $modifications - * + * @param string $dn + * @param array $modifications * @return bool */ public function update($dn, array $modifications) @@ -1814,9 +1801,8 @@ class Builder /** * Update an entries attribute in the directory. * - * @param string $dn - * @param array $attributes - * + * @param string $dn + * @param array $attributes * @return bool */ public function updateAttributes($dn, array $attributes) @@ -1829,8 +1815,7 @@ class Builder /** * Delete an entry from the directory. * - * @param string $dn - * + * @param string $dn * @return bool */ public function delete($dn) @@ -1843,9 +1828,8 @@ class Builder /** * Delete attributes on the entry in the directory. * - * @param string $dn - * @param array $attributes - * + * @param string $dn + * @param array $attributes * @return bool */ public function deleteAttributes($dn, array $attributes) @@ -1858,11 +1842,10 @@ class Builder /** * Rename an entry in the directory. * - * @param string $dn - * @param string $rdn - * @param string $newParentDn - * @param bool $deleteOldRdn - * + * @param string $dn + * @param string $rdn + * @param string $newParentDn + * @param bool $deleteOldRdn * @return bool */ public function rename($dn, $rdn, $newParentDn, $deleteOldRdn = true) @@ -1872,12 +1855,21 @@ class Builder }); } + /** + * Clone the query. + * + * @return static + */ + public function clone() + { + return clone $this; + } + /** * Handle dynamic method calls on the query builder. * - * @param string $method - * @param array $parameters - * + * @param string $method + * @param array $parameters * @return mixed * * @throws BadMethodCallException @@ -1901,9 +1893,8 @@ class Builder /** * Handles dynamic "where" clauses to the query. * - * @param string $method - * @param array $parameters - * + * @param string $method + * @param array $parameters * @return $this */ public function dynamicWhere($method, $parameters) @@ -1943,10 +1934,9 @@ class Builder /** * Adds an array of wheres to the current query. * - * @param array $wheres - * @param string $boolean - * @param bool $raw - * + * @param array $wheres + * @param string $boolean + * @param bool $raw * @return $this */ protected function addArrayOfWheres($wheres, $boolean, $raw) @@ -1975,11 +1965,10 @@ class Builder /** * Add a single dynamic where clause statement to the query. * - * @param string $segment - * @param string $connector - * @param array $parameters - * @param int $index - * + * @param string $segment + * @param string $connector + * @param array $parameters + * @param int $index * @return void */ protected function addDynamic($segment, $connector, $parameters, $index) @@ -1996,10 +1985,9 @@ class Builder /** * Logs the given executed query information by firing its query event. * - * @param Builder $query - * @param string $type - * @param null|float $time - * + * @param Builder $query + * @param string $type + * @param null|float $time * @return void */ protected function logQuery($query, $type, $time = null) @@ -2030,8 +2018,7 @@ class Builder /** * Fires the given query event. * - * @param QueryExecuted $event - * + * @param QueryExecuted $event * @return void */ protected function fireQueryEvent(QueryExecuted $event) @@ -2042,8 +2029,7 @@ class Builder /** * Get the elapsed time since a given starting point. * - * @param int $start - * + * @param int $start * @return float */ protected function getElapsedTime($start) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Cache.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Cache.php index dfbf8cd28..d6057bfb3 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Cache.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Cache.php @@ -21,7 +21,7 @@ class Cache /** * Constructor. * - * @param CacheInterface $store + * @param CacheInterface $store */ public function __construct(CacheInterface $store) { @@ -31,8 +31,7 @@ class Cache /** * Get an item from the cache. * - * @param string $key - * + * @param string $key * @return mixed */ public function get($key) @@ -43,10 +42,9 @@ class Cache /** * Store an item in the cache. * - * @param string $key - * @param mixed $value - * @param DateTimeInterface|DateInterval|int|null $ttl - * + * @param string $key + * @param mixed $value + * @param DateTimeInterface|DateInterval|int|null $ttl * @return bool */ public function put($key, $value, $ttl = null) @@ -63,10 +61,9 @@ class Cache /** * Get an item from the cache, or execute the given Closure and store the result. * - * @param string $key - * @param DateTimeInterface|DateInterval|int|null $ttl - * @param Closure $callback - * + * @param string $key + * @param DateTimeInterface|DateInterval|int|null $ttl + * @param Closure $callback * @return mixed */ public function remember($key, $ttl, Closure $callback) @@ -85,8 +82,7 @@ class Cache /** * Delete an item from the cache. * - * @param string $key - * + * @param string $key * @return bool */ public function delete($key) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Events/QueryExecuted.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Events/QueryExecuted.php index 4f17ea2a4..8ed8f835d 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Events/QueryExecuted.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Events/QueryExecuted.php @@ -23,8 +23,8 @@ class QueryExecuted /** * Constructor. * - * @param Builder $query - * @param null|float $time + * @param Builder $query + * @param null|float $time */ public function __construct(Builder $query, $time = null) { diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Filter/ConditionNode.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Filter/ConditionNode.php new file mode 100644 index 000000000..6203360c5 --- /dev/null +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Filter/ConditionNode.php @@ -0,0 +1,100 @@ +=', '<=', '~=', '=']; + + /** + * Constructor. + * + * @param string $filter + */ + public function __construct($filter) + { + $this->raw = $filter; + + [$this->attribute, $this->value] = $this->extractComponents($filter); + } + + /** + * Get the condition's attribute. + * + * @return string + */ + public function getAttribute() + { + return $this->attribute; + } + + /** + * Get the condition's operator. + * + * @return string + */ + public function getOperator() + { + return $this->operator; + } + + /** + * Get the condition's value. + * + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Extract the condition components from the filter. + * + * @param string $filter + * @return array + */ + protected function extractComponents($filter) + { + $components = Str::whenContains( + $filter, + $this->operators, + function ($operator, $filter) { + return explode($this->operator = $operator, $filter, 2); + }, + function ($filter) { + throw new ParserException("Invalid query condition. No operator found in [$filter]"); + }, + ); + + return $components; + } +} diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Filter/GroupNode.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Filter/GroupNode.php new file mode 100644 index 000000000..1a3596f3e --- /dev/null +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Filter/GroupNode.php @@ -0,0 +1,54 @@ +raw = $filter; + + $this->operator = substr($filter, 0, 1); + + $this->nodes = Parser::parse($filter); + } + + /** + * Get the group's operator. + * + * @return string + */ + public function getOperator() + { + return $this->operator; + } + + /** + * Get the group's sub-nodes. + * + * @return Node[] + */ + public function getNodes() + { + return $this->nodes; + } +} diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Filter/Node.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Filter/Node.php new file mode 100644 index 000000000..faf88d41f --- /dev/null +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Filter/Node.php @@ -0,0 +1,30 @@ +raw; + } +} diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Filter/Parser.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Filter/Parser.php new file mode 100644 index 000000000..7717ac522 --- /dev/null +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Filter/Parser.php @@ -0,0 +1,162 @@ + '"("', 1 => '")"']; + + throw new ParserException( + sprintf('Unclosed filter group. Missing %s parenthesis', $errors[$open <=> $close]) + ); + } + + return static::buildNodes( + array_map('trim', static::match($string)) + ); + } + + /** + * Perform a match for all filters in the string. + * + * @param string $string + * @return array + */ + protected static function match($string) + { + preg_match_all("/\((((?>[^()]+)|(?R))*)\)/", trim($string), $matches); + + return $matches[1] ?? []; + } + + /** + * Assemble the parsed nodes into a single filter. + * + * @param Node|Node[] $nodes + * @return string + */ + public static function assemble($nodes = []) + { + return array_reduce(Arr::wrap($nodes), function ($carry, Node $node) { + return $carry .= static::compileNode($node); + }); + } + + /** + * Assemble the node into its string based format. + * + * @param GroupNode|ConditionNode $node + * @return string + */ + protected static function compileNode(Node $node) + { + switch (true) { + case $node instanceof GroupNode: + return static::wrap($node->getOperator().static::assemble($node->getNodes())); + case $node instanceof ConditionNode: + return static::wrap($node->getAttribute().$node->getOperator().$node->getValue()); + default: + return $node->getRaw(); + } + } + + /** + * Build an array of nodes from the given filters. + * + * @param string[] $filters + * @return (ConditionNode|GroupNode)[] + * + * @throws ParserException + */ + protected static function buildNodes(array $filters = []) + { + return array_map(function ($filter) { + if (static::isWrapped($filter)) { + $filter = static::unwrap($filter); + } + + if (static::isGroup($filter) && ! Str::endsWith($filter, ')')) { + throw new ParserException(sprintf('Unclosed filter group [%s]', Str::afterLast($filter, ')'))); + } + + return static::isGroup($filter) + ? new GroupNode($filter) + : new ConditionNode($filter); + }, $filters); + } + + /** + * Count the open and close parenthesis of the sting. + * + * @param string $string + * @return array + */ + protected static function countParenthesis($string) + { + return [Str::substrCount($string, '('), Str::substrCount($string, ')')]; + } + + /** + * Wrap the value in parentheses. + * + * @param string $value + * @return string + */ + protected static function wrap($value) + { + return "($value)"; + } + + /** + * Recursively unwrwap the value from its parentheses. + * + * @param string $value + * @return string + */ + protected static function unwrap($value) + { + $nodes = static::parse($value); + + $unwrapped = Arr::first($nodes); + + return $unwrapped instanceof Node ? $unwrapped->getRaw() : $value; + } + + /** + * Determine if the filter is wrapped. + * + * @param string $filter + * @return bool + */ + protected static function isWrapped($filter) + { + return Str::startsWith($filter, '(') && Str::endsWith($filter, ')'); + } + + /** + * Determine if the filter is a group. + * + * @param string $filter + * @return bool + */ + protected static function isGroup($filter) + { + return Str::startsWith($filter, ['&', '|', '!']); + } +} diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Filter/ParserException.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Filter/ParserException.php new file mode 100644 index 000000000..68a4ca171 --- /dev/null +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Filter/ParserException.php @@ -0,0 +1,9 @@ +=', $count = 1) @@ -250,9 +239,8 @@ class Grammar * * Produces: (field=value) * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return string */ public function compileEquals($field, $value) @@ -265,9 +253,8 @@ class Grammar * * Produces: (!(field=value)) * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return string */ public function compileDoesNotEqual($field, $value) @@ -282,9 +269,8 @@ class Grammar * * Produces: (!(field=value)) * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return string */ public function compileDoesNotEqualAlias($field, $value) @@ -297,9 +283,8 @@ class Grammar * * Produces: (field>=value) * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return string */ public function compileGreaterThanOrEquals($field, $value) @@ -312,9 +297,8 @@ class Grammar * * Produces: (field<=value) * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return string */ public function compileLessThanOrEquals($field, $value) @@ -327,9 +311,8 @@ class Grammar * * Produces: (field~=value) * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return string */ public function compileApproximatelyEquals($field, $value) @@ -342,9 +325,8 @@ class Grammar * * Produces: (field=value*) * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return string */ public function compileStartsWith($field, $value) @@ -357,9 +339,8 @@ class Grammar * * Produces: (!(field=*value)) * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return string */ public function compileNotStartsWith($field, $value) @@ -374,9 +355,8 @@ class Grammar * * Produces: (field=*value) * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return string */ public function compileEndsWith($field, $value) @@ -389,9 +369,8 @@ class Grammar * * Produces: (!(field=value*)) * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return string */ public function compileNotEndsWith($field, $value) @@ -404,9 +383,8 @@ class Grammar * * Produces: (field=*value*) * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return string */ public function compileContains($field, $value) @@ -419,9 +397,8 @@ class Grammar * * Produces: (!(field=*value*)) * - * @param string $field - * @param string $value - * + * @param string $field + * @param string $value * @return string */ public function compileNotContains($field, $value) @@ -436,8 +413,7 @@ class Grammar * * Produces: (field=*) * - * @param string $field - * + * @param string $field * @return string */ public function compileHas($field) @@ -450,8 +426,7 @@ class Grammar * * Produces: (!(field=*)) * - * @param string $field - * + * @param string $field * @return string */ public function compileNotHas($field) @@ -466,8 +441,7 @@ class Grammar * * Produces: (&query) * - * @param string $query - * + * @param string $query * @return string */ public function compileAnd($query) @@ -480,8 +454,7 @@ class Grammar * * Produces: (|query) * - * @param string $query - * + * @param string $query * @return string */ public function compileOr($query) @@ -492,8 +465,7 @@ class Grammar /** * Wraps the inserted query inside an NOT operator. * - * @param string $query - * + * @param string $query * @return string */ public function compileNot($query) @@ -504,8 +476,7 @@ class Grammar /** * Assembles a single where query. * - * @param array $where - * + * @param array $where * @return string * * @throws UnexpectedValueException @@ -520,8 +491,7 @@ class Grammar /** * Make the compile method name for the operator. * - * @param string $operator - * + * @param string $operator * @return string * * @throws UnexpectedValueException @@ -538,8 +508,7 @@ class Grammar /** * Determine if the operator exists. * - * @param string $operator - * + * @param string $operator * @return bool */ protected function operatorExists($operator) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/InteractsWithTime.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/InteractsWithTime.php index 1562ec0a4..e8024c033 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/InteractsWithTime.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/InteractsWithTime.php @@ -16,8 +16,7 @@ trait InteractsWithTime /** * Get the number of seconds until the given DateTime. * - * @param DateTimeInterface|DateInterval|int $delay - * + * @param DateTimeInterface|DateInterval|int $delay * @return int */ protected function secondsUntil($delay) @@ -32,8 +31,7 @@ trait InteractsWithTime /** * Get the "available at" UNIX timestamp. * - * @param DateTimeInterface|DateInterval|int $delay - * + * @param DateTimeInterface|DateInterval|int $delay * @return int */ protected function availableAt($delay = 0) @@ -48,8 +46,7 @@ trait InteractsWithTime /** * If the given value is an interval, convert it to a DateTime instance. * - * @param DateTimeInterface|DateInterval|int $delay - * + * @param DateTimeInterface|DateInterval|int $delay * @return DateTimeInterface|int */ protected function parseDateInterval($delay) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Model/ActiveDirectoryBuilder.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Model/ActiveDirectoryBuilder.php index c3911d80e..3b0e96f79 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Model/ActiveDirectoryBuilder.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Model/ActiveDirectoryBuilder.php @@ -12,9 +12,8 @@ class ActiveDirectoryBuilder extends Builder /** * Finds a record by its Object SID. * - * @param string $sid - * @param array|string $columns - * + * @param string $sid + * @param array|string $columns * @return \LdapRecord\Models\ActiveDirectory\Entry|static|null */ public function findBySid($sid, $columns = []) @@ -31,9 +30,8 @@ class ActiveDirectoryBuilder extends Builder * * Fails upon no records returned. * - * @param string $sid - * @param array|string $columns - * + * @param string $sid + * @param array|string $columns * @return \LdapRecord\Models\ActiveDirectory\Entry|static * * @throws ModelNotFoundException @@ -70,9 +68,8 @@ class ActiveDirectoryBuilder extends Builder /** * Adds a 'where member' filter to the current query. * - * @param string $dn - * @param bool $nested - * + * @param string $dn + * @param bool $nested * @return $this */ public function whereMember($dn, $nested = false) @@ -85,9 +82,8 @@ class ActiveDirectoryBuilder extends Builder /** * Adds an 'or where member' filter to the current query. * - * @param string $dn - * @param bool $nested - * + * @param string $dn + * @param bool $nested * @return $this */ public function orWhereMember($dn, $nested = false) @@ -100,9 +96,8 @@ class ActiveDirectoryBuilder extends Builder /** * Adds a 'where member of' filter to the current query. * - * @param string $dn - * @param bool $nested - * + * @param string $dn + * @param bool $nested * @return $this */ public function whereMemberOf($dn, $nested = false) @@ -115,9 +110,8 @@ class ActiveDirectoryBuilder extends Builder /** * Adds a 'where not member of' filter to the current query. * - * @param string $dn - * @param bool $nested - * + * @param string $dn + * @param bool $nested * @return $this */ public function whereNotMemberof($dn, $nested = false) @@ -130,9 +124,8 @@ class ActiveDirectoryBuilder extends Builder /** * Adds an 'or where member of' filter to the current query. * - * @param string $dn - * @param bool $nested - * + * @param string $dn + * @param bool $nested * @return $this */ public function orWhereMemberOf($dn, $nested = false) @@ -145,9 +138,8 @@ class ActiveDirectoryBuilder extends Builder /** * Adds a 'or where not member of' filter to the current query. * - * @param string $dn - * @param bool $nested - * + * @param string $dn + * @param bool $nested * @return $this */ public function orWhereNotMemberof($dn, $nested = false) @@ -160,9 +152,8 @@ class ActiveDirectoryBuilder extends Builder /** * Adds a 'where manager' filter to the current query. * - * @param string $dn - * @param bool $nested - * + * @param string $dn + * @param bool $nested * @return $this */ public function whereManager($dn, $nested = false) @@ -175,9 +166,8 @@ class ActiveDirectoryBuilder extends Builder /** * Adds a 'where not manager' filter to the current query. * - * @param string $dn - * @param bool $nested - * + * @param string $dn + * @param bool $nested * @return $this */ public function whereNotManager($dn, $nested = false) @@ -190,9 +180,8 @@ class ActiveDirectoryBuilder extends Builder /** * Adds an 'or where manager' filter to the current query. * - * @param string $dn - * @param bool $nested - * + * @param string $dn + * @param bool $nested * @return $this */ public function orWhereManager($dn, $nested = false) @@ -205,9 +194,8 @@ class ActiveDirectoryBuilder extends Builder /** * Adds an 'or where not manager' filter to the current query. * - * @param string $dn - * @param bool $nested - * + * @param string $dn + * @param bool $nested * @return $this */ public function orWhereNotManager($dn, $nested = false) @@ -220,10 +208,9 @@ class ActiveDirectoryBuilder extends Builder /** * Execute the callback with a nested match attribute. * - * @param Closure $callback - * @param string $attribute - * @param bool $nested - * + * @param Closure $callback + * @param string $attribute + * @param bool $nested * @return $this */ protected function nestedMatchQuery(Closure $callback, $attribute, $nested = false) @@ -236,8 +223,7 @@ class ActiveDirectoryBuilder extends Builder /** * Make a "nested match" filter attribute for querying descendants. * - * @param string $attribute - * + * @param string $attribute * @return string */ protected function makeNestedMatchAttribute($attribute) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Model/Builder.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Model/Builder.php index 234dd0ad7..a6886ea96 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Model/Builder.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Model/Builder.php @@ -44,9 +44,8 @@ class Builder extends BaseBuilder /** * Dynamically handle calls into the query instance. * - * @param string $method - * @param array $parameters - * + * @param string $method + * @param array $parameters * @return mixed */ public function __call($method, $parameters) @@ -61,9 +60,8 @@ class Builder extends BaseBuilder /** * Apply the given scope on the current builder instance. * - * @param callable $scope - * @param array $parameters - * + * @param callable $scope + * @param array $parameters * @return mixed */ protected function callScope(callable $scope, $parameters = []) @@ -91,8 +89,7 @@ class Builder extends BaseBuilder /** * Set the model instance for the model being queried. * - * @param Model $model - * + * @param Model $model * @return $this */ public function setModel(Model $model) @@ -115,8 +112,7 @@ class Builder extends BaseBuilder /** * Get a new model query builder instance. * - * @param string|null $baseDn - * + * @param string|null $baseDn * @return static */ public function newInstance($baseDn = null) @@ -127,9 +123,8 @@ class Builder extends BaseBuilder /** * Finds a model by its distinguished name. * - * @param array|string $dn - * @param array|string|string[] $columns - * + * @param array|string $dn + * @param array|string|string[] $columns * @return Model|\LdapRecord\Query\Collection|static|null */ public function find($dn, $columns = ['*']) @@ -142,9 +137,8 @@ class Builder extends BaseBuilder /** * Finds a record using ambiguous name resolution. * - * @param string|array $value - * @param array|string $columns - * + * @param string|array $value + * @param array|string $columns * @return Model|\LdapRecord\Query\Collection|static|null */ public function findByAnr($value, $columns = ['*']) @@ -178,9 +172,8 @@ class Builder extends BaseBuilder * * If a record is not found, an exception is thrown. * - * @param string $value - * @param array|string $columns - * + * @param string $value + * @param array|string $columns * @return Model * * @throws ModelNotFoundException @@ -197,8 +190,8 @@ class Builder extends BaseBuilder /** * Throws a not found exception. * - * @param string $query - * @param string $dn + * @param string $query + * @param string $dn * * @throws ModelNotFoundException */ @@ -210,9 +203,8 @@ class Builder extends BaseBuilder /** * Finds multiple records using ambiguous name resolution. * - * @param array $values - * @param array $columns - * + * @param array $values + * @param array $columns * @return \LdapRecord\Query\Collection */ public function findManyByAnr(array $values = [], $columns = ['*']) @@ -233,8 +225,7 @@ class Builder extends BaseBuilder /** * Creates an ANR equivalent query for LDAP distributions that do not support ANR. * - * @param string $value - * + * @param string $value * @return $this */ protected function prepareAnrEquivalentQuery($value) @@ -249,9 +240,8 @@ class Builder extends BaseBuilder /** * Finds a record by its string GUID. * - * @param string $guid - * @param array|string $columns - * + * @param string $guid + * @param array|string $columns * @return Model|static|null */ public function findByGuid($guid, $columns = ['*']) @@ -268,9 +258,8 @@ class Builder extends BaseBuilder * * Fails upon no records returned. * - * @param string $guid - * @param array|string $columns - * + * @param string $guid + * @param array|string $columns * @return Model|static * * @throws ModelNotFoundException @@ -299,8 +288,7 @@ class Builder extends BaseBuilder /** * Apply the query scopes and execute the callback. * - * @param Closure $callback - * + * @param Closure $callback * @return mixed */ protected function afterScopes(Closure $callback) @@ -339,9 +327,8 @@ class Builder extends BaseBuilder /** * Register a new global scope. * - * @param string $identifier - * @param Scope|\Closure $scope - * + * @param string $identifier + * @param Scope|\Closure $scope * @return $this */ public function withGlobalScope($identifier, $scope) @@ -354,8 +341,7 @@ class Builder extends BaseBuilder /** * Remove a registered global scope. * - * @param Scope|string $scope - * + * @param Scope|string $scope * @return $this */ public function withoutGlobalScope($scope) @@ -374,8 +360,7 @@ class Builder extends BaseBuilder /** * Remove all or passed registered global scopes. * - * @param array|null $scopes - * + * @param array|null $scopes * @return $this */ public function withoutGlobalScopes(array $scopes = null) @@ -414,8 +399,7 @@ class Builder extends BaseBuilder /** * Processes and converts the given LDAP results into models. * - * @param array $results - * + * @param array $results * @return \LdapRecord\Query\Collection */ protected function process(array $results) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/ObjectNotFoundException.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/ObjectNotFoundException.php index c22563cfa..99c2e85e3 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/ObjectNotFoundException.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/ObjectNotFoundException.php @@ -23,9 +23,8 @@ class ObjectNotFoundException extends LdapRecordException /** * Create a new exception for the executed filter. * - * @param string $query - * @param ?string $baseDn - * + * @param string $query + * @param ?string $baseDn * @return static */ public static function forQuery($query, $baseDn = null) @@ -36,9 +35,8 @@ class ObjectNotFoundException extends LdapRecordException /** * Set the query that was used. * - * @param string $query - * @param string|null $baseDn - * + * @param string $query + * @param string|null $baseDn * @return $this */ public function setQuery($query, $baseDn = null) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Pagination/AbstractPaginator.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Pagination/AbstractPaginator.php index e2b048242..11e2dc547 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Pagination/AbstractPaginator.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Pagination/AbstractPaginator.php @@ -38,7 +38,7 @@ abstract class AbstractPaginator /** * Constructor. * - * @param Builder $query + * @param Builder $query */ public function __construct(Builder $query, $filter, $perPage, $isCritical) { @@ -51,8 +51,7 @@ abstract class AbstractPaginator /** * Execute the pagination request. * - * @param LdapInterface $ldap - * + * @param LdapInterface $ldap * @return array */ public function execute(LdapInterface $ldap) @@ -107,8 +106,7 @@ abstract class AbstractPaginator /** * Apply the server controls. * - * @param LdapInterface $ldap - * + * @param LdapInterface $ldap * @return void */ abstract protected function applyServerControls(LdapInterface $ldap); @@ -116,8 +114,7 @@ abstract class AbstractPaginator /** * Reset the server controls. * - * @param LdapInterface $ldap - * + * @param LdapInterface $ldap * @return void */ abstract protected function resetServerControls(LdapInterface $ldap); @@ -125,9 +122,8 @@ abstract class AbstractPaginator /** * Update the server controls. * - * @param LdapInterface $ldap - * @param resource $resource - * + * @param LdapInterface $ldap + * @param resource $resource * @return void */ abstract protected function updateServerControls(LdapInterface $ldap, $resource); diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Pagination/LazyPaginator.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Pagination/LazyPaginator.php index b9df77e4e..8b12d526c 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Pagination/LazyPaginator.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Pagination/LazyPaginator.php @@ -9,8 +9,7 @@ class LazyPaginator extends Paginator /** * Execute the pagination request. * - * @param LdapInterface $ldap - * + * @param LdapInterface $ldap * @return \Generator */ public function execute(LdapInterface $ldap) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Slice.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Slice.php new file mode 100644 index 000000000..12faa5bd1 --- /dev/null +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Query/Slice.php @@ -0,0 +1,283 @@ +items = $items; + $this->total = $total; + $this->perPage = $perPage; + $this->lastPage = max((int) ceil($total / $perPage), 1); + $this->currentPage = $currentPage ?? 1; + } + + /** + * Get the slice of items being paginated. + * + * @return \LdapRecord\Query\Collection|array + */ + public function items() + { + return $this->items; + } + + /** + * Get the total number of items being paginated. + * + * @return int + */ + public function total() + { + return $this->total; + } + + /** + * Get the number of items shown per page. + * + * @return int + */ + public function perPage() + { + return $this->perPage; + } + + /** + * Determine if there are more items in the data source. + * + * @return bool + */ + public function hasMorePages() + { + return $this->currentPage() < $this->lastPage(); + } + + /** + * Determine if there are enough items to split into multiple pages. + * + * @return bool + */ + public function hasPages() + { + return $this->currentPage() != 1 || $this->hasMorePages(); + } + + /** + * Determine if the paginator is on the first page. + * + * @return bool + */ + public function onFirstPage() + { + return $this->currentPage() <= 1; + } + + /** + * Determine if the paginator is on the last page. + * + * @return bool + */ + public function onLastPage() + { + return ! $this->hasMorePages(); + } + + /** + * Get the current page. + * + * @return int + */ + public function currentPage() + { + return $this->currentPage; + } + + /** + * Get the last page. + * + * @return int + */ + public function lastPage() + { + return $this->lastPage; + } + + /** + * Get an iterator for the items. + * + * @return \ArrayIterator + */ + #[\ReturnTypeWillChange] + public function getIterator() + { + return new ArrayIterator($this->items); + } + + /** + * Determine if the list of items is empty. + * + * @return bool + */ + public function isEmpty() + { + return empty($this->items); + } + + /** + * Determine if the list of items is not empty. + * + * @return bool + */ + public function isNotEmpty() + { + return ! $this->isEmpty(); + } + + /** + * Get the number of items for the current page. + * + * @return int + */ + #[\ReturnTypeWillChange] + public function count() + { + return count($this->items); + } + + /** + * Determine if the given item exists. + * + * @param mixed $key + * @return bool + */ + #[\ReturnTypeWillChange] + public function offsetExists($key) + { + return array_key_exists($key, $this->items); + } + + /** + * Get the item at the given offset. + * + * @param mixed $key + * @return mixed + */ + #[\ReturnTypeWillChange] + public function offsetGet($key) + { + return $this->items[$key] ?? null; + } + + /** + * Set the item at the given offset. + * + * @param mixed $key + * @param mixed $value + * @return void + */ + #[\ReturnTypeWillChange] + public function offsetSet($key, $value) + { + $this->items[$key] = $value; + } + + /** + * Unset the item at the given key. + * + * @param mixed $key + * @return void + */ + #[\ReturnTypeWillChange] + public function offsetUnset($key) + { + unset($this->items[$key]); + } + + /** + * Convert the object into something JSON serializable. + * + * @return array + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return $this->toArray(); + } + + /** + * Get the arrayable items. + * + * @return array + */ + public function getArrayableItems() + { + return $this->items instanceof Collection + ? $this->items->all() + : $this->items; + } + + /** + * Get the instance as an array. + * + * @return array + */ + public function toArray() + { + return [ + 'current_page' => $this->currentPage(), + 'data' => $this->getArrayableItems(), + 'last_page' => $this->lastPage(), + 'per_page' => $this->perPage(), + 'total' => $this->total(), + ]; + } +} diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Support/Arr.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Support/Arr.php index 8fa87a2b3..7475859ae 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Support/Arr.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Support/Arr.php @@ -9,8 +9,7 @@ class Arr /** * Determine whether the given value is array accessible. * - * @param mixed $value - * + * @param mixed $value * @return bool */ public static function accessible($value) @@ -21,9 +20,8 @@ class Arr /** * Determine if the given key exists in the provided array. * - * @param \ArrayAccess|array $array - * @param string|int $key - * + * @param \ArrayAccess|array $array + * @param string|int $key * @return bool */ public static function exists($array, $key) @@ -38,8 +36,7 @@ class Arr /** * If the given value is not an array and not null, wrap it in one. * - * @param mixed $value - * + * @param mixed $value * @return array */ public static function wrap($value) @@ -54,10 +51,9 @@ class Arr /** * Return the first element in an array passing a given truth test. * - * @param iterable $array - * @param callable|null $callback - * @param mixed $default - * + * @param iterable $array + * @param callable|null $callback + * @param mixed $default * @return mixed */ public static function first($array, callable $callback = null, $default = null) @@ -84,10 +80,9 @@ class Arr /** * Return the last element in an array passing a given truth test. * - * @param array $array - * @param callable|null $callback - * @param mixed $default - * + * @param array $array + * @param callable|null $callback + * @param mixed $default * @return mixed */ public static function last($array, callable $callback = null, $default = null) @@ -102,10 +97,9 @@ class Arr /** * Get an item from an array using "dot" notation. * - * @param ArrayAccess|array $array - * @param string|int|null $key - * @param mixed $default - * + * @param ArrayAccess|array $array + * @param string|int|null $key + * @param mixed $default * @return mixed */ public static function get($array, $key, $default = null) @@ -122,7 +116,7 @@ class Arr return $array[$key]; } - if (strpos($key, '.') === false) { + if (str_contains($key, '.')) { return $array[$key] ?? Helpers::value($default); } diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Support/Helpers.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Support/Helpers.php index a55d1d22a..ab217d6ff 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Support/Helpers.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Support/Helpers.php @@ -9,12 +9,12 @@ class Helpers /** * Return the default value of the given value. * - * @param mixed $value - * + * @param mixed $value + * @param mixed $args * @return mixed */ - public static function value($value) + public static function value($value, ...$args) { - return $value instanceof Closure ? $value() : $value; + return $value instanceof Closure ? $value(...$args) : $value; } } diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Support/Str.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Support/Str.php new file mode 100644 index 000000000..820834e21 --- /dev/null +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Support/Str.php @@ -0,0 +1,129 @@ + $arg) { - if (! $arg instanceof Constraint) { - $args[$key] = new IsEqual($arg); + $this->args = array_map(function ($arg) { + if ($arg instanceof Closure) { + return new Callback($arg); } - } - $this->args = $args; + if (! $arg instanceof Constraint) { + return new IsEqual($arg); + } + + return $arg; + }, is_array($args) ? $args : func_get_args()); return $this; } @@ -114,8 +117,7 @@ class LdapExpectation /** * Set the expected value to return. * - * @param mixed $value - * + * @param mixed $value * @return $this */ public function andReturn($value) @@ -128,10 +130,9 @@ class LdapExpectation /** * The error message to return from the expectation. * - * @param int $code - * @param string $error - * @param string $diagnosticMessage - * + * @param int $code + * @param string $error + * @param string $diagnosticMessage * @return $this */ public function andReturnError($code = 1, $error = '', $diagnosticMessage = '') @@ -148,8 +149,7 @@ class LdapExpectation /** * Set the expected exception to throw. * - * @param string|\Exception|LdapRecordException $exception - * + * @param string|\Exception|LdapRecordException $exception * @return $this */ public function andThrow($exception) @@ -186,8 +186,7 @@ class LdapExpectation /** * Set the expectation to be called the given number of times. * - * @param int $count - * + * @param int $count * @return $this */ public function times($count = 1) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Testing/LdapFake.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Testing/LdapFake.php index 00470e14a..5a0003549 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Testing/LdapFake.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Testing/LdapFake.php @@ -47,8 +47,7 @@ class LdapFake implements LdapInterface /** * Create a new expected operation. * - * @param string $method - * + * @param string $method * @return LdapExpectation */ public static function operation($method) @@ -59,8 +58,7 @@ class LdapFake implements LdapInterface /** * Set the user that will pass binding. * - * @param string $dn - * + * @param string $dn * @return $this */ public function shouldAuthenticateWith($dn) @@ -73,8 +71,7 @@ class LdapFake implements LdapInterface /** * Add an LDAP method expectation. * - * @param LdapExpectation|array $expectations - * + * @param LdapExpectation|array $expectations * @return $this */ public function expect($expectations = []) @@ -105,8 +102,7 @@ class LdapFake implements LdapInterface /** * Determine if the method has any expectations. * - * @param string $method - * + * @param string $method * @return bool */ public function hasExpectations($method) @@ -117,8 +113,7 @@ class LdapFake implements LdapInterface /** * Get expectations by method. * - * @param string $method - * + * @param string $method * @return LdapExpectation[]|mixed */ public function getExpectations($method) @@ -129,9 +124,8 @@ class LdapFake implements LdapInterface /** * Remove an expectation by method and key. * - * @param string $method - * @param int $key - * + * @param string $method + * @param int $key * @return void */ public function removeExpectation($method, $key) @@ -142,8 +136,7 @@ class LdapFake implements LdapInterface /** * Set the error number of a failed bind attempt. * - * @param int $number - * + * @param int $number * @return $this */ public function shouldReturnErrorNumber($number = 1) @@ -156,8 +149,7 @@ class LdapFake implements LdapInterface /** * Set the last error of a failed bind attempt. * - * @param string $message - * + * @param string $message * @return $this */ public function shouldReturnError($message = '') @@ -170,8 +162,7 @@ class LdapFake implements LdapInterface /** * Set the diagnostic message of a failed bind attempt. * - * @param string $message - * + * @param string $message * @return $this */ public function shouldReturnDiagnosticMessage($message = '') @@ -261,6 +252,16 @@ class LdapFake implements LdapInterface : $this->bound; } + /** + * @inheritdoc + */ + public function getHost() + { + return $this->hasExpectations('getHost') + ? $this->resolveExpectation('getHost') + : $this->host; + } + /** * @inheritdoc */ @@ -454,9 +455,8 @@ class LdapFake implements LdapInterface /** * Resolve the methods expectations. * - * @param string $method - * @param array $args - * + * @param string $method + * @param array $args * @return mixed * * @throws Exception @@ -489,8 +489,7 @@ class LdapFake implements LdapInterface /** * Apply the expectation error to the fake. * - * @param LdapExpectation $expectation - * + * @param LdapExpectation $expectation * @return void */ protected function applyExpectationError(LdapExpectation $expectation) @@ -503,10 +502,9 @@ class LdapFake implements LdapInterface /** * Assert that the expected arguments match the operations arguments. * - * @param string $method - * @param Constraint[] $expectedArgs - * @param array $methodArgs - * + * @param string $method + * @param Constraint[] $expectedArgs + * @param array $methodArgs * @return void */ protected function assertMethodArgumentsMatch($method, array $expectedArgs = [], array $methodArgs = []) diff --git a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Utilities.php b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Utilities.php index 01d55c797..c4f5190d8 100644 --- a/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Utilities.php +++ b/data/web/inc/lib/vendor/directorytree/ldaprecord/src/Utilities.php @@ -10,14 +10,13 @@ class Utilities * This will also decode hex characters into their true * UTF-8 representation embedded inside the DN as well. * - * @param string $dn - * @param bool $removeAttributePrefixes - * + * @param string $dn + * @param bool $removeAttributePrefixes * @return array|false */ public static function explodeDn($dn, $removeAttributePrefixes = true) { - $dn = ldap_explode_dn($dn, ($removeAttributePrefixes ? 1 : 0)); + $dn = ldap_explode_dn($dn, $removeAttributePrefixes ? 1 : 0); if (! is_array($dn)) { return false; @@ -39,8 +38,7 @@ class Utilities /** * Un-escapes a hexadecimal string into its original string representation. * - * @param string $value - * + * @param string $value * @return string */ public static function unescape($value) @@ -58,8 +56,7 @@ class Utilities * @see https://github.com/ChadSikorra * @see https://stackoverflow.com/questions/39533560/php-ldap-get-user-sid * - * @param string $value The Binary SID - * + * @param string $value The Binary SID * @return string|null */ public static function binarySidToString($value) @@ -106,8 +103,7 @@ class Utilities /** * Convert a binary GUID to a string GUID. * - * @param string $binGuid - * + * @param string $binGuid * @return string|null */ public static function binaryGuidToString($binGuid) @@ -130,8 +126,7 @@ class Utilities /** * Converts a string GUID to it's hex variant. * - * @param string $string - * + * @param string $string * @return string */ public static function stringGuidToHex($string) @@ -149,21 +144,19 @@ class Utilities * Round a Windows timestamp down to seconds and remove * the seconds between 1601-01-01 and 1970-01-01. * - * @param float $windowsTime - * - * @return float + * @param int $windowsTime + * @return int */ public static function convertWindowsTimeToUnixTime($windowsTime) { - return round($windowsTime / 10000000) - 11644473600; + return (int) (round($windowsTime / 10000000) - 11644473600); } /** * Convert a Unix timestamp to Windows timestamp. * - * @param float $unixTime - * - * @return float + * @param int $unixTime + * @return int */ public static function convertUnixTimeToWindowsTime($unixTime) { @@ -173,8 +166,7 @@ class Utilities /** * Validates that the inserted string is an object SID. * - * @param string $sid - * + * @param string $sid * @return bool */ public static function isValidSid($sid) @@ -185,8 +177,7 @@ class Utilities /** * Validates that the inserted string is an object GUID. * - * @param string $guid - * + * @param string $guid * @return bool */ public static function isValidGuid($guid) diff --git a/data/web/inc/lib/vendor/illuminate/contracts/Auth/Access/Gate.php b/data/web/inc/lib/vendor/illuminate/contracts/Auth/Access/Gate.php index b88ab1796..eb605d827 100644 --- a/data/web/inc/lib/vendor/illuminate/contracts/Auth/Access/Gate.php +++ b/data/web/inc/lib/vendor/illuminate/contracts/Auth/Access/Gate.php @@ -57,18 +57,18 @@ interface Gate public function after(callable $callback); /** - * Determine if the given ability should be granted for the current user. + * Determine if all of the given abilities should be granted for the current user. * - * @param string $ability + * @param iterable|string $ability * @param array|mixed $arguments * @return bool */ public function allows($ability, $arguments = []); /** - * Determine if the given ability should be denied for the current user. + * Determine if any of the given abilities should be denied for the current user. * - * @param string $ability + * @param iterable|string $ability * @param array|mixed $arguments * @return bool */ diff --git a/data/web/inc/lib/vendor/illuminate/contracts/Broadcasting/ShouldBeUnique.php b/data/web/inc/lib/vendor/illuminate/contracts/Broadcasting/ShouldBeUnique.php new file mode 100644 index 000000000..c72b7a800 --- /dev/null +++ b/data/web/inc/lib/vendor/illuminate/contracts/Broadcasting/ShouldBeUnique.php @@ -0,0 +1,8 @@ +|CastsAttributes|CastsInboundAttributes */ public static function castUsing(array $arguments); } diff --git a/data/web/inc/lib/vendor/illuminate/contracts/Database/Eloquent/CastsAttributes.php b/data/web/inc/lib/vendor/illuminate/contracts/Database/Eloquent/CastsAttributes.php index 808d005f5..89cec66a7 100644 --- a/data/web/inc/lib/vendor/illuminate/contracts/Database/Eloquent/CastsAttributes.php +++ b/data/web/inc/lib/vendor/illuminate/contracts/Database/Eloquent/CastsAttributes.php @@ -2,6 +2,12 @@ namespace Illuminate\Contracts\Database\Eloquent; +use Illuminate\Database\Eloquent\Model; + +/** + * @template TGet + * @template TSet + */ interface CastsAttributes { /** @@ -10,19 +16,19 @@ interface CastsAttributes * @param \Illuminate\Database\Eloquent\Model $model * @param string $key * @param mixed $value - * @param array $attributes - * @return mixed + * @param array $attributes + * @return TGet|null */ - public function get($model, string $key, $value, array $attributes); + public function get(Model $model, string $key, mixed $value, array $attributes); /** * Transform the attribute to its underlying model values. * * @param \Illuminate\Database\Eloquent\Model $model * @param string $key - * @param mixed $value - * @param array $attributes + * @param TSet|null $value + * @param array $attributes * @return mixed */ - public function set($model, string $key, $value, array $attributes); + public function set(Model $model, string $key, mixed $value, array $attributes); } diff --git a/data/web/inc/lib/vendor/illuminate/contracts/Database/Eloquent/CastsInboundAttributes.php b/data/web/inc/lib/vendor/illuminate/contracts/Database/Eloquent/CastsInboundAttributes.php index 4c7801b58..6a3e2ef18 100644 --- a/data/web/inc/lib/vendor/illuminate/contracts/Database/Eloquent/CastsInboundAttributes.php +++ b/data/web/inc/lib/vendor/illuminate/contracts/Database/Eloquent/CastsInboundAttributes.php @@ -2,6 +2,8 @@ namespace Illuminate\Contracts\Database\Eloquent; +use Illuminate\Database\Eloquent\Model; + interface CastsInboundAttributes { /** @@ -13,5 +15,5 @@ interface CastsInboundAttributes * @param array $attributes * @return mixed */ - public function set($model, string $key, $value, array $attributes); + public function set(Model $model, string $key, mixed $value, array $attributes); } diff --git a/data/web/inc/lib/vendor/illuminate/contracts/Database/Eloquent/SerializesCastableAttributes.php b/data/web/inc/lib/vendor/illuminate/contracts/Database/Eloquent/SerializesCastableAttributes.php index a89f91010..a2ecf16f5 100644 --- a/data/web/inc/lib/vendor/illuminate/contracts/Database/Eloquent/SerializesCastableAttributes.php +++ b/data/web/inc/lib/vendor/illuminate/contracts/Database/Eloquent/SerializesCastableAttributes.php @@ -2,6 +2,8 @@ namespace Illuminate\Contracts\Database\Eloquent; +use Illuminate\Database\Eloquent\Model; + interface SerializesCastableAttributes { /** @@ -13,5 +15,5 @@ interface SerializesCastableAttributes * @param array $attributes * @return mixed */ - public function serialize($model, string $key, $value, array $attributes); + public function serialize(Model $model, string $key, mixed $value, array $attributes); } diff --git a/data/web/inc/lib/vendor/illuminate/contracts/Database/ModelIdentifier.php b/data/web/inc/lib/vendor/illuminate/contracts/Database/ModelIdentifier.php index 9893d280e..aacd18c07 100644 --- a/data/web/inc/lib/vendor/illuminate/contracts/Database/ModelIdentifier.php +++ b/data/web/inc/lib/vendor/illuminate/contracts/Database/ModelIdentifier.php @@ -34,6 +34,13 @@ class ModelIdentifier */ public $connection; + /** + * The class name of the model collection. + * + * @var string|null + */ + public $collectionClass; + /** * Create a new model identifier. * @@ -50,4 +57,17 @@ class ModelIdentifier $this->relations = $relations; $this->connection = $connection; } + + /** + * Specify the collection class that should be used when serializing / restoring collections. + * + * @param string|null $collectionClass + * @return $this + */ + public function useCollectionClass(?string $collectionClass) + { + $this->collectionClass = $collectionClass; + + return $this; + } } diff --git a/data/web/inc/lib/vendor/illuminate/contracts/Database/Query/ConditionExpression.php b/data/web/inc/lib/vendor/illuminate/contracts/Database/Query/ConditionExpression.php new file mode 100644 index 000000000..b2e97a6e8 --- /dev/null +++ b/data/web/inc/lib/vendor/illuminate/contracts/Database/Query/ConditionExpression.php @@ -0,0 +1,7 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\MessageFormatter; + +use Symfony\Component\Translation\Formatter\MessageFormatterInterface; + +if (!class_exists(LazyMessageFormatter::class, false)) { + abstract class LazyMessageFormatter implements MessageFormatterInterface + { + public function format(string $message, string $locale, array $parameters = []): string + { + return $this->formatter->format( + $message, + $this->transformLocale($locale), + $parameters + ); + } + } +} diff --git a/data/web/inc/lib/vendor/nesbot/carbon/lazy/Carbon/MessageFormatter/MessageFormatterMapperWeakType.php b/data/web/inc/lib/vendor/nesbot/carbon/lazy/Carbon/MessageFormatter/MessageFormatterMapperWeakType.php new file mode 100644 index 000000000..cbd890d5b --- /dev/null +++ b/data/web/inc/lib/vendor/nesbot/carbon/lazy/Carbon/MessageFormatter/MessageFormatterMapperWeakType.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\MessageFormatter; + +use Symfony\Component\Translation\Formatter\ChoiceMessageFormatterInterface; +use Symfony\Component\Translation\Formatter\MessageFormatterInterface; + +if (!class_exists(LazyMessageFormatter::class, false)) { + abstract class LazyMessageFormatter implements MessageFormatterInterface, ChoiceMessageFormatterInterface + { + abstract protected function transformLocale(?string $locale): ?string; + + public function format($message, $locale, array $parameters = []) + { + return $this->formatter->format( + $message, + $this->transformLocale($locale), + $parameters + ); + } + + public function choiceFormat($message, $number, $locale, array $parameters = []) + { + return $this->formatter->choiceFormat($message, $number, $locale, $parameters); + } + } +} diff --git a/data/web/inc/lib/vendor/nesbot/carbon/lazy/Carbon/PHPStan/AbstractMacroBuiltin.php b/data/web/inc/lib/vendor/nesbot/carbon/lazy/Carbon/PHPStan/AbstractMacroBuiltin.php new file mode 100644 index 000000000..ba7cf6320 --- /dev/null +++ b/data/web/inc/lib/vendor/nesbot/carbon/lazy/Carbon/PHPStan/AbstractMacroBuiltin.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\PHPStan; + +use PHPStan\BetterReflection\Reflection; +use ReflectionMethod; + +if (!class_exists(AbstractReflectionMacro::class, false)) { + abstract class AbstractReflectionMacro extends AbstractMacro + { + /** + * {@inheritdoc} + */ + public function getReflection(): ?ReflectionMethod + { + if ($this->reflectionFunction instanceof Reflection\ReflectionMethod) { + return new Reflection\Adapter\ReflectionMethod($this->reflectionFunction); + } + + return $this->reflectionFunction instanceof ReflectionMethod + ? $this->reflectionFunction + : null; + } + } +} diff --git a/data/web/inc/lib/vendor/nesbot/carbon/lazy/Carbon/PHPStan/AbstractMacroStatic.php b/data/web/inc/lib/vendor/nesbot/carbon/lazy/Carbon/PHPStan/AbstractMacroStatic.php new file mode 100644 index 000000000..bd4c8e804 --- /dev/null +++ b/data/web/inc/lib/vendor/nesbot/carbon/lazy/Carbon/PHPStan/AbstractMacroStatic.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\PHPStan; + +use PHPStan\BetterReflection\Reflection; +use ReflectionMethod; + +if (!class_exists(AbstractReflectionMacro::class, false)) { + abstract class AbstractReflectionMacro extends AbstractMacro + { + /** + * {@inheritdoc} + */ + public function getReflection(): ?Reflection\Adapter\ReflectionMethod + { + if ($this->reflectionFunction instanceof Reflection\Adapter\ReflectionMethod) { + return $this->reflectionFunction; + } + + if ($this->reflectionFunction instanceof Reflection\ReflectionMethod) { + return new Reflection\Adapter\ReflectionMethod($this->reflectionFunction); + } + + return $this->reflectionFunction instanceof ReflectionMethod + ? new Reflection\Adapter\ReflectionMethod( + Reflection\ReflectionMethod::createFromName( + $this->reflectionFunction->getDeclaringClass()->getName(), + $this->reflectionFunction->getName() + ) + ) + : null; + } + } +} diff --git a/data/web/inc/lib/vendor/nesbot/carbon/lazy/Carbon/PHPStan/MacroStrongType.php b/data/web/inc/lib/vendor/nesbot/carbon/lazy/Carbon/PHPStan/MacroStrongType.php index eacd9c1ea..f615b3a64 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/lazy/Carbon/PHPStan/MacroStrongType.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/lazy/Carbon/PHPStan/MacroStrongType.php @@ -14,14 +14,16 @@ declare(strict_types=1); namespace Carbon\PHPStan; if (!class_exists(LazyMacro::class, false)) { - abstract class LazyMacro extends AbstractMacro + abstract class LazyMacro extends AbstractReflectionMacro { /** * {@inheritdoc} */ public function getFileName(): ?string { - return $this->reflectionFunction->getFileName(); + $file = $this->reflectionFunction->getFileName(); + + return (($file ? realpath($file) : null) ?: $file) ?: null; } /** diff --git a/data/web/inc/lib/vendor/nesbot/carbon/lazy/Carbon/PHPStan/MacroWeakType.php b/data/web/inc/lib/vendor/nesbot/carbon/lazy/Carbon/PHPStan/MacroWeakType.php index 3e9fcf4f7..bf64c1dd9 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/lazy/Carbon/PHPStan/MacroWeakType.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/lazy/Carbon/PHPStan/MacroWeakType.php @@ -14,7 +14,7 @@ declare(strict_types=1); namespace Carbon\PHPStan; if (!class_exists(LazyMacro::class, false)) { - abstract class LazyMacro extends AbstractMacro + abstract class LazyMacro extends AbstractReflectionMacro { /** * {@inheritdoc} @@ -23,7 +23,9 @@ if (!class_exists(LazyMacro::class, false)) { */ public function getFileName() { - return $this->reflectionFunction->getFileName(); + $file = $this->reflectionFunction->getFileName(); + + return (($file ? realpath($file) : null) ?: $file) ?: null; } /** diff --git a/data/web/inc/lib/vendor/nesbot/carbon/readme.md b/data/web/inc/lib/vendor/nesbot/carbon/readme.md index 5d827219e..3f4117706 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/readme.md +++ b/data/web/inc/lib/vendor/nesbot/carbon/readme.md @@ -2,7 +2,7 @@ [![Latest Stable Version](https://img.shields.io/packagist/v/nesbot/carbon.svg?style=flat-square)](https://packagist.org/packages/nesbot/carbon) [![Total Downloads](https://img.shields.io/packagist/dt/nesbot/carbon.svg?style=flat-square)](https://packagist.org/packages/nesbot/carbon) -[![GitHub Actions](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fbriannesbitt%2FCarbon%2Fbadge&style=flat-square&label=Build&logo=none)](https://actions-badge.atrox.dev/briannesbitt/Carbon/goto) +[![GitHub Actions](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fbriannesbitt%2FCarbon%2Fbadge&style=flat-square&label=Build&logo=none)](https://github.com/briannesbitt/Carbon/actions) [![codecov.io](https://img.shields.io/codecov/c/github/briannesbitt/Carbon.svg?style=flat-square)](https://codecov.io/github/briannesbitt/Carbon?branch=master) [![Tidelift](https://tidelift.com/badges/github/briannesbitt/Carbon)](https://tidelift.com/subscription/pkg/packagist-nesbot-carbon?utm_source=packagist-nesbot-carbon&utm_medium=referral&utm_campaign=readme) @@ -119,21 +119,52 @@ This project exists thanks to all the people who contribute. Support this project by becoming a sponsor. Your logo will show up here with a link to your website. - - - - - - - + +Онлайн казино +CasinoHex Canada +Probukmacher +Игровые автоматы +Casino-portugal.pt +Slots City +inkedin +Онлайн казино України +OnlineCasinosSpelen +Best non Gamstop sites in the UK +Real Money Pokies +Non GamStop Bookies UK +Онлайн Казино Украины +SSSTwitter +Non-GamStop Bets UK +Chudovo +UK Casino Gap +NZ Casino Deps +NonStopCasino.org +Migliori Siti Non AAMS +UK NonGamStopCasinos +SnapTik +IG Downloader +Proxidize +Blastup +AzuraCast +Triplebyte +GitHub Sponsors +Salesforce + -[[Become a sponsor](https://opencollective.com/Carbon#sponsor)] +[[Become a sponsor via OpenCollective](https://opencollective.com/Carbon#sponsor)] + + + + + + +[[Become a sponsor via GitHub](https://github.com/sponsors/kylekatarnls)] ### Backers Thank you to all our backers! 🙏 - + [[Become a backer](https://opencollective.com/Carbon#backer)] diff --git a/data/web/inc/lib/vendor/nesbot/carbon/sponsors.php b/data/web/inc/lib/vendor/nesbot/carbon/sponsors.php new file mode 100644 index 000000000..67b217161 --- /dev/null +++ b/data/web/inc/lib/vendor/nesbot/carbon/sponsors.php @@ -0,0 +1,129 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Carbon\CarbonImmutable; + +require_once __DIR__.'/vendor/autoload.php'; + +function getMaxHistoryMonthsByAmount($amount): int +{ + if ($amount >= 50) { + return 6; + } + + if ($amount >= 20) { + return 4; + } + + return 2; +} + +function getHtmlAttribute($rawValue): string +{ + return str_replace( + ['​', "\r"], + '', + trim(htmlspecialchars((string) $rawValue), "  \n\r\t\v\0"), + ); +} + +function getOpenCollectiveSponsors(): string +{ + $customSponsorImages = [ + // For consistency and equity among sponsors, as of now, we kindly ask our sponsors + // to provide an image having a width/height ratio between 1/1 and 2/1. + // By default, we'll show the member picture from OpenCollective, and will resize it if bigger + // int(OpenCollective.MemberId) => ImageURL + ]; + + $members = json_decode(file_get_contents('https://opencollective.com/carbon/members/all.json'), true); + + $list = array_filter($members, static function ($member): bool { + return ($member['lastTransactionAmount'] > 3 || $member['isActive']) && + $member['role'] === 'BACKER' && + $member['type'] !== 'USER' && + ( + $member['totalAmountDonated'] > 100 || + $member['lastTransactionAt'] > CarbonImmutable::now() + ->subMonthsNoOverflow(getMaxHistoryMonthsByAmount($member['lastTransactionAmount'])) + ->format('Y-m-d h:i') || + $member['isActive'] && $member['lastTransactionAmount'] >= 30 + ); + }); + + $list = array_map(static function (array $member): array { + $createdAt = CarbonImmutable::parse($member['createdAt']); + $lastTransactionAt = CarbonImmutable::parse($member['lastTransactionAt']); + + if ($createdAt->format('d H:i:s.u') > $lastTransactionAt->format('d H:i:s.u')) { + $createdAt = $createdAt + ->setDay($lastTransactionAt->day) + ->modify($lastTransactionAt->format('H:i:s.u')); + } + + $monthlyContribution = (float) ($member['totalAmountDonated'] / ceil($createdAt->floatDiffInMonths())); + + if ( + $lastTransactionAt->isAfter('last month') && + $member['lastTransactionAmount'] > $monthlyContribution + ) { + $monthlyContribution = (float) $member['lastTransactionAmount']; + } + + $yearlyContribution = (float) ($member['totalAmountDonated'] / max(1, $createdAt->floatDiffInYears())); + $status = null; + + if ($monthlyContribution > 29) { + $status = 'sponsor'; + } elseif ($monthlyContribution > 4.5 || $yearlyContribution > 29) { + $status = 'backer'; + } elseif ($member['totalAmountDonated'] > 0) { + $status = 'helper'; + } + + return array_merge($member, [ + 'star' => ($monthlyContribution > 98 || $yearlyContribution > 500), + 'status' => $status, + 'monthlyContribution' => $monthlyContribution, + 'yearlyContribution' => $yearlyContribution, + ]); + }, $list); + + usort($list, static function (array $a, array $b): int { + return ($b['monthlyContribution'] <=> $a['monthlyContribution']) + ?: ($b['totalAmountDonated'] <=> $a['totalAmountDonated']); + }); + + return implode('', array_map(static function (array $member) use ($customSponsorImages): string { + $href = htmlspecialchars($member['website'] ?? $member['profile']); + $src = $customSponsorImages[$member['MemberId'] ?? ''] ?? $member['image'] ?? (strtr($member['profile'], ['https://opencollective.com/' => 'https://images.opencollective.com/']).'/avatar/256.png'); + [$x, $y] = @getimagesize($src) ?: [0, 0]; + $validImage = ($x && $y); + $src = $validImage ? htmlspecialchars($src) : 'https://opencollective.com/static/images/default-guest-logo.svg'; + $height = $member['status'] === 'sponsor' ? 64 : 42; + $width = min($height * 2, $validImage ? round($x * $height / $y) : $height); + $href .= (strpos($href, '?') === false ? '?' : '&').'utm_source=opencollective&utm_medium=github&utm_campaign=Carbon'; + $title = getHtmlAttribute(($member['description'] ?? null) ?: $member['name']); + $alt = getHtmlAttribute($member['name']); + + return "\n".''. + ''.$alt.''. + ''; + }, $list))."\n"; +} + +file_put_contents('readme.md', preg_replace_callback( + '/()[\s\S]+()/', + static function (array $match): string { + return $match[1].getOpenCollectiveSponsors().$match[2]; + }, + file_get_contents('readme.md') +)); diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/AbstractTranslator.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/AbstractTranslator.php index 48441e7c2..8b8fe089e 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/AbstractTranslator.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/AbstractTranslator.php @@ -11,6 +11,7 @@ namespace Carbon; +use Carbon\MessageFormatter\MessageFormatterMapper; use Closure; use ReflectionException; use ReflectionFunction; @@ -51,7 +52,7 @@ abstract class AbstractTranslator extends Translation\Translator /** * List of locales aliases. * - * @var string[] + * @var array */ protected $aliases = [ 'me' => 'sr_Latn_ME', @@ -83,7 +84,7 @@ abstract class AbstractTranslator extends Translation\Translator $this->initializing = true; $this->directories = [__DIR__.'/Lang']; $this->addLoader('array', new ArrayLoader()); - parent::__construct($locale, $formatter, $cacheDir, $debug); + parent::__construct($locale, new MessageFormatterMapper($formatter), $cacheDir, $debug); $this->initializing = false; } @@ -220,8 +221,8 @@ abstract class AbstractTranslator extends Translation\Translator $catalogue = $this->getCatalogue($locale); $format = $this instanceof TranslatorStrongTypeInterface - ? $this->getFromCatalogue($catalogue, (string) $id, $domain) // @codeCoverageIgnore - : $this->getCatalogue($locale)->get((string) $id, $domain); + ? $this->getFromCatalogue($catalogue, (string) $id, $domain) + : $this->getCatalogue($locale)->get((string) $id, $domain); // @codeCoverageIgnore if ($format instanceof Closure) { // @codeCoverageIgnoreStart @@ -250,11 +251,7 @@ abstract class AbstractTranslator extends Translation\Translator */ protected function loadMessagesFromFile($locale) { - if (isset($this->messages[$locale])) { - return true; - } - - return $this->resetMessages($locale); + return isset($this->messages[$locale]) || $this->resetMessages($locale); } /** @@ -311,7 +308,7 @@ abstract class AbstractTranslator extends Translation\Translator */ public function setLocale($locale) { - $locale = preg_replace_callback('/[-_]([a-z]{2,}|[0-9]{2,})/', function ($matches) { + $locale = preg_replace_callback('/[-_]([a-z]{2,}|\d{2,})/', function ($matches) { // _2-letters or YUE is a region, _3+-letters is a variant $upper = strtoupper($matches[1]); @@ -359,13 +356,13 @@ abstract class AbstractTranslator extends Translation\Translator parent::setLocale($macroLocale); } - if ($this->loadMessagesFromFile($locale) || $this->initializing) { - parent::setLocale($locale); - - return true; + if (!$this->loadMessagesFromFile($locale) && !$this->initializing) { + return false; } - return false; + parent::setLocale($locale); + + return true; } /** diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Carbon.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Carbon.php index e327590e2..e32569ae3 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Carbon.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Carbon.php @@ -33,477 +33,477 @@ use DateTimeZone; * @property int $second * @property int $micro * @property int $microsecond - * @property int|float|string $timestamp seconds since the Unix Epoch - * @property string $englishDayOfWeek the day of week in English - * @property string $shortEnglishDayOfWeek the abbreviated day of week in English - * @property string $englishMonth the month in English - * @property string $shortEnglishMonth the abbreviated month in English + * @property int|float|string $timestamp seconds since the Unix Epoch + * @property string $englishDayOfWeek the day of week in English + * @property string $shortEnglishDayOfWeek the abbreviated day of week in English + * @property string $englishMonth the month in English + * @property string $shortEnglishMonth the abbreviated month in English * @property int $milliseconds * @property int $millisecond * @property int $milli - * @property int $week 1 through 53 - * @property int $isoWeek 1 through 53 - * @property int $weekYear year according to week format - * @property int $isoWeekYear year according to ISO week format - * @property int $dayOfYear 1 through 366 - * @property int $age does a diffInYears() with default parameters - * @property int $offset the timezone offset in seconds from UTC - * @property int $offsetMinutes the timezone offset in minutes from UTC - * @property int $offsetHours the timezone offset in hours from UTC - * @property CarbonTimeZone $timezone the current timezone - * @property CarbonTimeZone $tz alias of $timezone - * @property-read int $dayOfWeek 0 (for Sunday) through 6 (for Saturday) - * @property-read int $dayOfWeekIso 1 (for Monday) through 7 (for Sunday) - * @property-read int $weekOfYear ISO-8601 week number of year, weeks starting on Monday - * @property-read int $daysInMonth number of days in the given month - * @property-read string $latinMeridiem "am"/"pm" (Ante meridiem or Post meridiem latin lowercase mark) - * @property-read string $latinUpperMeridiem "AM"/"PM" (Ante meridiem or Post meridiem latin uppercase mark) - * @property-read string $timezoneAbbreviatedName the current timezone abbreviated name - * @property-read string $tzAbbrName alias of $timezoneAbbreviatedName - * @property-read string $dayName long name of weekday translated according to Carbon locale, in english if no translation available for current language - * @property-read string $shortDayName short name of weekday translated according to Carbon locale, in english if no translation available for current language - * @property-read string $minDayName very short name of weekday translated according to Carbon locale, in english if no translation available for current language - * @property-read string $monthName long name of month translated according to Carbon locale, in english if no translation available for current language - * @property-read string $shortMonthName short name of month translated according to Carbon locale, in english if no translation available for current language - * @property-read string $meridiem lowercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language - * @property-read string $upperMeridiem uppercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language - * @property-read int $noZeroHour current hour from 1 to 24 - * @property-read int $weeksInYear 51 through 53 - * @property-read int $isoWeeksInYear 51 through 53 - * @property-read int $weekOfMonth 1 through 5 - * @property-read int $weekNumberInMonth 1 through 5 - * @property-read int $firstWeekDay 0 through 6 - * @property-read int $lastWeekDay 0 through 6 - * @property-read int $daysInYear 365 or 366 - * @property-read int $quarter the quarter of this instance, 1 - 4 - * @property-read int $decade the decade of this instance - * @property-read int $century the century of this instance - * @property-read int $millennium the millennium of this instance - * @property-read bool $dst daylight savings time indicator, true if DST, false otherwise - * @property-read bool $local checks if the timezone is local, true if local, false otherwise - * @property-read bool $utc checks if the timezone is UTC, true if UTC, false otherwise - * @property-read string $timezoneName the current timezone name - * @property-read string $tzName alias of $timezoneName - * @property-read string $locale locale of the current instance + * @property int $week 1 through 53 + * @property int $isoWeek 1 through 53 + * @property int $weekYear year according to week format + * @property int $isoWeekYear year according to ISO week format + * @property int $dayOfYear 1 through 366 + * @property int $age does a diffInYears() with default parameters + * @property int $offset the timezone offset in seconds from UTC + * @property int $offsetMinutes the timezone offset in minutes from UTC + * @property int $offsetHours the timezone offset in hours from UTC + * @property CarbonTimeZone $timezone the current timezone + * @property CarbonTimeZone $tz alias of $timezone + * @property-read int $dayOfWeek 0 (for Sunday) through 6 (for Saturday) + * @property-read int $dayOfWeekIso 1 (for Monday) through 7 (for Sunday) + * @property-read int $weekOfYear ISO-8601 week number of year, weeks starting on Monday + * @property-read int $daysInMonth number of days in the given month + * @property-read string $latinMeridiem "am"/"pm" (Ante meridiem or Post meridiem latin lowercase mark) + * @property-read string $latinUpperMeridiem "AM"/"PM" (Ante meridiem or Post meridiem latin uppercase mark) + * @property-read string $timezoneAbbreviatedName the current timezone abbreviated name + * @property-read string $tzAbbrName alias of $timezoneAbbreviatedName + * @property-read string $dayName long name of weekday translated according to Carbon locale, in english if no translation available for current language + * @property-read string $shortDayName short name of weekday translated according to Carbon locale, in english if no translation available for current language + * @property-read string $minDayName very short name of weekday translated according to Carbon locale, in english if no translation available for current language + * @property-read string $monthName long name of month translated according to Carbon locale, in english if no translation available for current language + * @property-read string $shortMonthName short name of month translated according to Carbon locale, in english if no translation available for current language + * @property-read string $meridiem lowercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language + * @property-read string $upperMeridiem uppercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language + * @property-read int $noZeroHour current hour from 1 to 24 + * @property-read int $weeksInYear 51 through 53 + * @property-read int $isoWeeksInYear 51 through 53 + * @property-read int $weekOfMonth 1 through 5 + * @property-read int $weekNumberInMonth 1 through 5 + * @property-read int $firstWeekDay 0 through 6 + * @property-read int $lastWeekDay 0 through 6 + * @property-read int $daysInYear 365 or 366 + * @property-read int $quarter the quarter of this instance, 1 - 4 + * @property-read int $decade the decade of this instance + * @property-read int $century the century of this instance + * @property-read int $millennium the millennium of this instance + * @property-read bool $dst daylight savings time indicator, true if DST, false otherwise + * @property-read bool $local checks if the timezone is local, true if local, false otherwise + * @property-read bool $utc checks if the timezone is UTC, true if UTC, false otherwise + * @property-read string $timezoneName the current timezone name + * @property-read string $tzName alias of $timezoneName + * @property-read string $locale locale of the current instance * - * @method bool isUtc() Check if the current instance has UTC timezone. (Both isUtc and isUTC cases are valid.) - * @method bool isLocal() Check if the current instance has non-UTC timezone. - * @method bool isValid() Check if the current instance is a valid date. - * @method bool isDST() Check if the current instance is in a daylight saving time. - * @method bool isSunday() Checks if the instance day is sunday. - * @method bool isMonday() Checks if the instance day is monday. - * @method bool isTuesday() Checks if the instance day is tuesday. - * @method bool isWednesday() Checks if the instance day is wednesday. - * @method bool isThursday() Checks if the instance day is thursday. - * @method bool isFriday() Checks if the instance day is friday. - * @method bool isSaturday() Checks if the instance day is saturday. - * @method bool isSameYear(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same year as the instance. If null passed, compare to now (with the same timezone). - * @method bool isCurrentYear() Checks if the instance is in the same year as the current moment. - * @method bool isNextYear() Checks if the instance is in the same year as the current moment next year. - * @method bool isLastYear() Checks if the instance is in the same year as the current moment last year. - * @method bool isSameWeek(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same week as the instance. If null passed, compare to now (with the same timezone). - * @method bool isCurrentWeek() Checks if the instance is in the same week as the current moment. - * @method bool isNextWeek() Checks if the instance is in the same week as the current moment next week. - * @method bool isLastWeek() Checks if the instance is in the same week as the current moment last week. - * @method bool isSameDay(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same day as the instance. If null passed, compare to now (with the same timezone). - * @method bool isCurrentDay() Checks if the instance is in the same day as the current moment. - * @method bool isNextDay() Checks if the instance is in the same day as the current moment next day. - * @method bool isLastDay() Checks if the instance is in the same day as the current moment last day. - * @method bool isSameHour(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same hour as the instance. If null passed, compare to now (with the same timezone). - * @method bool isCurrentHour() Checks if the instance is in the same hour as the current moment. - * @method bool isNextHour() Checks if the instance is in the same hour as the current moment next hour. - * @method bool isLastHour() Checks if the instance is in the same hour as the current moment last hour. - * @method bool isSameMinute(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same minute as the instance. If null passed, compare to now (with the same timezone). - * @method bool isCurrentMinute() Checks if the instance is in the same minute as the current moment. - * @method bool isNextMinute() Checks if the instance is in the same minute as the current moment next minute. - * @method bool isLastMinute() Checks if the instance is in the same minute as the current moment last minute. - * @method bool isSameSecond(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same second as the instance. If null passed, compare to now (with the same timezone). - * @method bool isCurrentSecond() Checks if the instance is in the same second as the current moment. - * @method bool isNextSecond() Checks if the instance is in the same second as the current moment next second. - * @method bool isLastSecond() Checks if the instance is in the same second as the current moment last second. - * @method bool isSameMicro(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone). - * @method bool isCurrentMicro() Checks if the instance is in the same microsecond as the current moment. - * @method bool isNextMicro() Checks if the instance is in the same microsecond as the current moment next microsecond. - * @method bool isLastMicro() Checks if the instance is in the same microsecond as the current moment last microsecond. - * @method bool isSameMicrosecond(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone). - * @method bool isCurrentMicrosecond() Checks if the instance is in the same microsecond as the current moment. - * @method bool isNextMicrosecond() Checks if the instance is in the same microsecond as the current moment next microsecond. - * @method bool isLastMicrosecond() Checks if the instance is in the same microsecond as the current moment last microsecond. - * @method bool isCurrentMonth() Checks if the instance is in the same month as the current moment. - * @method bool isNextMonth() Checks if the instance is in the same month as the current moment next month. - * @method bool isLastMonth() Checks if the instance is in the same month as the current moment last month. - * @method bool isCurrentQuarter() Checks if the instance is in the same quarter as the current moment. - * @method bool isNextQuarter() Checks if the instance is in the same quarter as the current moment next quarter. - * @method bool isLastQuarter() Checks if the instance is in the same quarter as the current moment last quarter. - * @method bool isSameDecade(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same decade as the instance. If null passed, compare to now (with the same timezone). - * @method bool isCurrentDecade() Checks if the instance is in the same decade as the current moment. - * @method bool isNextDecade() Checks if the instance is in the same decade as the current moment next decade. - * @method bool isLastDecade() Checks if the instance is in the same decade as the current moment last decade. - * @method bool isSameCentury(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same century as the instance. If null passed, compare to now (with the same timezone). - * @method bool isCurrentCentury() Checks if the instance is in the same century as the current moment. - * @method bool isNextCentury() Checks if the instance is in the same century as the current moment next century. - * @method bool isLastCentury() Checks if the instance is in the same century as the current moment last century. - * @method bool isSameMillennium(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same millennium as the instance. If null passed, compare to now (with the same timezone). - * @method bool isCurrentMillennium() Checks if the instance is in the same millennium as the current moment. - * @method bool isNextMillennium() Checks if the instance is in the same millennium as the current moment next millennium. - * @method bool isLastMillennium() Checks if the instance is in the same millennium as the current moment last millennium. - * @method $this years(int $value) Set current instance year to the given value. - * @method $this year(int $value) Set current instance year to the given value. - * @method $this setYears(int $value) Set current instance year to the given value. - * @method $this setYear(int $value) Set current instance year to the given value. - * @method $this months(int $value) Set current instance month to the given value. - * @method $this month(int $value) Set current instance month to the given value. - * @method $this setMonths(int $value) Set current instance month to the given value. - * @method $this setMonth(int $value) Set current instance month to the given value. - * @method $this days(int $value) Set current instance day to the given value. - * @method $this day(int $value) Set current instance day to the given value. - * @method $this setDays(int $value) Set current instance day to the given value. - * @method $this setDay(int $value) Set current instance day to the given value. - * @method $this hours(int $value) Set current instance hour to the given value. - * @method $this hour(int $value) Set current instance hour to the given value. - * @method $this setHours(int $value) Set current instance hour to the given value. - * @method $this setHour(int $value) Set current instance hour to the given value. - * @method $this minutes(int $value) Set current instance minute to the given value. - * @method $this minute(int $value) Set current instance minute to the given value. - * @method $this setMinutes(int $value) Set current instance minute to the given value. - * @method $this setMinute(int $value) Set current instance minute to the given value. - * @method $this seconds(int $value) Set current instance second to the given value. - * @method $this second(int $value) Set current instance second to the given value. - * @method $this setSeconds(int $value) Set current instance second to the given value. - * @method $this setSecond(int $value) Set current instance second to the given value. - * @method $this millis(int $value) Set current instance millisecond to the given value. - * @method $this milli(int $value) Set current instance millisecond to the given value. - * @method $this setMillis(int $value) Set current instance millisecond to the given value. - * @method $this setMilli(int $value) Set current instance millisecond to the given value. - * @method $this milliseconds(int $value) Set current instance millisecond to the given value. - * @method $this millisecond(int $value) Set current instance millisecond to the given value. - * @method $this setMilliseconds(int $value) Set current instance millisecond to the given value. - * @method $this setMillisecond(int $value) Set current instance millisecond to the given value. - * @method $this micros(int $value) Set current instance microsecond to the given value. - * @method $this micro(int $value) Set current instance microsecond to the given value. - * @method $this setMicros(int $value) Set current instance microsecond to the given value. - * @method $this setMicro(int $value) Set current instance microsecond to the given value. - * @method $this microseconds(int $value) Set current instance microsecond to the given value. - * @method $this microsecond(int $value) Set current instance microsecond to the given value. - * @method $this setMicroseconds(int $value) Set current instance microsecond to the given value. - * @method $this setMicrosecond(int $value) Set current instance microsecond to the given value. - * @method $this addYears(int $value = 1) Add years (the $value count passed in) to the instance (using date interval). - * @method $this addYear() Add one year to the instance (using date interval). - * @method $this subYears(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval). - * @method $this subYear() Sub one year to the instance (using date interval). - * @method $this addYearsWithOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method $this addYearWithOverflow() Add one year to the instance (using date interval) with overflow explicitly allowed. - * @method $this subYearsWithOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method $this subYearWithOverflow() Sub one year to the instance (using date interval) with overflow explicitly allowed. - * @method $this addYearsWithoutOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addYearWithoutOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subYearsWithoutOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subYearWithoutOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addYearsWithNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addYearWithNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subYearsWithNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subYearWithNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addYearsNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addYearNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subYearsNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subYearNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addMonths(int $value = 1) Add months (the $value count passed in) to the instance (using date interval). - * @method $this addMonth() Add one month to the instance (using date interval). - * @method $this subMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval). - * @method $this subMonth() Sub one month to the instance (using date interval). - * @method $this addMonthsWithOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method $this addMonthWithOverflow() Add one month to the instance (using date interval) with overflow explicitly allowed. - * @method $this subMonthsWithOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method $this subMonthWithOverflow() Sub one month to the instance (using date interval) with overflow explicitly allowed. - * @method $this addMonthsWithoutOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addMonthWithoutOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subMonthsWithoutOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subMonthWithoutOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addMonthsWithNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addMonthWithNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subMonthsWithNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subMonthWithNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addMonthsNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addMonthNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subMonthsNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subMonthNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addDays(int $value = 1) Add days (the $value count passed in) to the instance (using date interval). - * @method $this addDay() Add one day to the instance (using date interval). - * @method $this subDays(int $value = 1) Sub days (the $value count passed in) to the instance (using date interval). - * @method $this subDay() Sub one day to the instance (using date interval). - * @method $this addHours(int $value = 1) Add hours (the $value count passed in) to the instance (using date interval). - * @method $this addHour() Add one hour to the instance (using date interval). - * @method $this subHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using date interval). - * @method $this subHour() Sub one hour to the instance (using date interval). - * @method $this addMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using date interval). - * @method $this addMinute() Add one minute to the instance (using date interval). - * @method $this subMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using date interval). - * @method $this subMinute() Sub one minute to the instance (using date interval). - * @method $this addSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using date interval). - * @method $this addSecond() Add one second to the instance (using date interval). - * @method $this subSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using date interval). - * @method $this subSecond() Sub one second to the instance (using date interval). - * @method $this addMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). - * @method $this addMilli() Add one millisecond to the instance (using date interval). - * @method $this subMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). - * @method $this subMilli() Sub one millisecond to the instance (using date interval). - * @method $this addMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). - * @method $this addMillisecond() Add one millisecond to the instance (using date interval). - * @method $this subMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). - * @method $this subMillisecond() Sub one millisecond to the instance (using date interval). - * @method $this addMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). - * @method $this addMicro() Add one microsecond to the instance (using date interval). - * @method $this subMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). - * @method $this subMicro() Sub one microsecond to the instance (using date interval). - * @method $this addMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). - * @method $this addMicrosecond() Add one microsecond to the instance (using date interval). - * @method $this subMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). - * @method $this subMicrosecond() Sub one microsecond to the instance (using date interval). - * @method $this addMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval). - * @method $this addMillennium() Add one millennium to the instance (using date interval). - * @method $this subMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval). - * @method $this subMillennium() Sub one millennium to the instance (using date interval). - * @method $this addMillenniaWithOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method $this addMillenniumWithOverflow() Add one millennium to the instance (using date interval) with overflow explicitly allowed. - * @method $this subMillenniaWithOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method $this subMillenniumWithOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly allowed. - * @method $this addMillenniaWithoutOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addMillenniumWithoutOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subMillenniaWithoutOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subMillenniumWithoutOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addMillenniaWithNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addMillenniumWithNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subMillenniaWithNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subMillenniumWithNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addMillenniaNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addMillenniumNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subMillenniaNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subMillenniumNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval). - * @method $this addCentury() Add one century to the instance (using date interval). - * @method $this subCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval). - * @method $this subCentury() Sub one century to the instance (using date interval). - * @method $this addCenturiesWithOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method $this addCenturyWithOverflow() Add one century to the instance (using date interval) with overflow explicitly allowed. - * @method $this subCenturiesWithOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method $this subCenturyWithOverflow() Sub one century to the instance (using date interval) with overflow explicitly allowed. - * @method $this addCenturiesWithoutOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addCenturyWithoutOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subCenturiesWithoutOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subCenturyWithoutOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addCenturiesWithNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addCenturyWithNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subCenturiesWithNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subCenturyWithNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addCenturiesNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addCenturyNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subCenturiesNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subCenturyNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval). - * @method $this addDecade() Add one decade to the instance (using date interval). - * @method $this subDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval). - * @method $this subDecade() Sub one decade to the instance (using date interval). - * @method $this addDecadesWithOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method $this addDecadeWithOverflow() Add one decade to the instance (using date interval) with overflow explicitly allowed. - * @method $this subDecadesWithOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method $this subDecadeWithOverflow() Sub one decade to the instance (using date interval) with overflow explicitly allowed. - * @method $this addDecadesWithoutOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addDecadeWithoutOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subDecadesWithoutOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subDecadeWithoutOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addDecadesWithNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addDecadeWithNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subDecadesWithNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subDecadeWithNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addDecadesNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addDecadeNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subDecadesNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subDecadeNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval). - * @method $this addQuarter() Add one quarter to the instance (using date interval). - * @method $this subQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval). - * @method $this subQuarter() Sub one quarter to the instance (using date interval). - * @method $this addQuartersWithOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method $this addQuarterWithOverflow() Add one quarter to the instance (using date interval) with overflow explicitly allowed. - * @method $this subQuartersWithOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method $this subQuarterWithOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly allowed. - * @method $this addQuartersWithoutOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addQuarterWithoutOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subQuartersWithoutOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subQuarterWithoutOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addQuartersWithNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addQuarterWithNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subQuartersWithNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subQuarterWithNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addQuartersNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addQuarterNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subQuartersNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method $this subQuarterNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. - * @method $this addWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using date interval). - * @method $this addWeek() Add one week to the instance (using date interval). - * @method $this subWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using date interval). - * @method $this subWeek() Sub one week to the instance (using date interval). - * @method $this addWeekdays(int $value = 1) Add weekdays (the $value count passed in) to the instance (using date interval). - * @method $this addWeekday() Add one weekday to the instance (using date interval). - * @method $this subWeekdays(int $value = 1) Sub weekdays (the $value count passed in) to the instance (using date interval). - * @method $this subWeekday() Sub one weekday to the instance (using date interval). - * @method $this addRealMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). - * @method $this addRealMicro() Add one microsecond to the instance (using timestamp). - * @method $this subRealMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). - * @method $this subRealMicro() Sub one microsecond to the instance (using timestamp). - * @method CarbonPeriod microsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given. - * @method $this addRealMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). - * @method $this addRealMicrosecond() Add one microsecond to the instance (using timestamp). - * @method $this subRealMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). - * @method $this subRealMicrosecond() Sub one microsecond to the instance (using timestamp). - * @method CarbonPeriod microsecondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given. - * @method $this addRealMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). - * @method $this addRealMilli() Add one millisecond to the instance (using timestamp). - * @method $this subRealMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). - * @method $this subRealMilli() Sub one millisecond to the instance (using timestamp). - * @method CarbonPeriod millisUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given. - * @method $this addRealMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). - * @method $this addRealMillisecond() Add one millisecond to the instance (using timestamp). - * @method $this subRealMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). - * @method $this subRealMillisecond() Sub one millisecond to the instance (using timestamp). - * @method CarbonPeriod millisecondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given. - * @method $this addRealSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using timestamp). - * @method $this addRealSecond() Add one second to the instance (using timestamp). - * @method $this subRealSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using timestamp). - * @method $this subRealSecond() Sub one second to the instance (using timestamp). - * @method CarbonPeriod secondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each second or every X seconds if a factor is given. - * @method $this addRealMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using timestamp). - * @method $this addRealMinute() Add one minute to the instance (using timestamp). - * @method $this subRealMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using timestamp). - * @method $this subRealMinute() Sub one minute to the instance (using timestamp). - * @method CarbonPeriod minutesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each minute or every X minutes if a factor is given. - * @method $this addRealHours(int $value = 1) Add hours (the $value count passed in) to the instance (using timestamp). - * @method $this addRealHour() Add one hour to the instance (using timestamp). - * @method $this subRealHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using timestamp). - * @method $this subRealHour() Sub one hour to the instance (using timestamp). - * @method CarbonPeriod hoursUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each hour or every X hours if a factor is given. - * @method $this addRealDays(int $value = 1) Add days (the $value count passed in) to the instance (using timestamp). - * @method $this addRealDay() Add one day to the instance (using timestamp). - * @method $this subRealDays(int $value = 1) Sub days (the $value count passed in) to the instance (using timestamp). - * @method $this subRealDay() Sub one day to the instance (using timestamp). - * @method CarbonPeriod daysUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each day or every X days if a factor is given. - * @method $this addRealWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using timestamp). - * @method $this addRealWeek() Add one week to the instance (using timestamp). - * @method $this subRealWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using timestamp). - * @method $this subRealWeek() Sub one week to the instance (using timestamp). - * @method CarbonPeriod weeksUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each week or every X weeks if a factor is given. - * @method $this addRealMonths(int $value = 1) Add months (the $value count passed in) to the instance (using timestamp). - * @method $this addRealMonth() Add one month to the instance (using timestamp). - * @method $this subRealMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using timestamp). - * @method $this subRealMonth() Sub one month to the instance (using timestamp). - * @method CarbonPeriod monthsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each month or every X months if a factor is given. - * @method $this addRealQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using timestamp). - * @method $this addRealQuarter() Add one quarter to the instance (using timestamp). - * @method $this subRealQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using timestamp). - * @method $this subRealQuarter() Sub one quarter to the instance (using timestamp). - * @method CarbonPeriod quartersUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each quarter or every X quarters if a factor is given. - * @method $this addRealYears(int $value = 1) Add years (the $value count passed in) to the instance (using timestamp). - * @method $this addRealYear() Add one year to the instance (using timestamp). - * @method $this subRealYears(int $value = 1) Sub years (the $value count passed in) to the instance (using timestamp). - * @method $this subRealYear() Sub one year to the instance (using timestamp). - * @method CarbonPeriod yearsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each year or every X years if a factor is given. - * @method $this addRealDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using timestamp). - * @method $this addRealDecade() Add one decade to the instance (using timestamp). - * @method $this subRealDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using timestamp). - * @method $this subRealDecade() Sub one decade to the instance (using timestamp). - * @method CarbonPeriod decadesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each decade or every X decades if a factor is given. - * @method $this addRealCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using timestamp). - * @method $this addRealCentury() Add one century to the instance (using timestamp). - * @method $this subRealCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using timestamp). - * @method $this subRealCentury() Sub one century to the instance (using timestamp). - * @method CarbonPeriod centuriesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each century or every X centuries if a factor is given. - * @method $this addRealMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using timestamp). - * @method $this addRealMillennium() Add one millennium to the instance (using timestamp). - * @method $this subRealMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using timestamp). - * @method $this subRealMillennium() Sub one millennium to the instance (using timestamp). - * @method CarbonPeriod millenniaUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millennium or every X millennia if a factor is given. - * @method $this roundYear(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. - * @method $this roundYears(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. - * @method $this floorYear(float $precision = 1) Truncate the current instance year with given precision. - * @method $this floorYears(float $precision = 1) Truncate the current instance year with given precision. - * @method $this ceilYear(float $precision = 1) Ceil the current instance year with given precision. - * @method $this ceilYears(float $precision = 1) Ceil the current instance year with given precision. - * @method $this roundMonth(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. - * @method $this roundMonths(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. - * @method $this floorMonth(float $precision = 1) Truncate the current instance month with given precision. - * @method $this floorMonths(float $precision = 1) Truncate the current instance month with given precision. - * @method $this ceilMonth(float $precision = 1) Ceil the current instance month with given precision. - * @method $this ceilMonths(float $precision = 1) Ceil the current instance month with given precision. - * @method $this roundDay(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. - * @method $this roundDays(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. - * @method $this floorDay(float $precision = 1) Truncate the current instance day with given precision. - * @method $this floorDays(float $precision = 1) Truncate the current instance day with given precision. - * @method $this ceilDay(float $precision = 1) Ceil the current instance day with given precision. - * @method $this ceilDays(float $precision = 1) Ceil the current instance day with given precision. - * @method $this roundHour(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. - * @method $this roundHours(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. - * @method $this floorHour(float $precision = 1) Truncate the current instance hour with given precision. - * @method $this floorHours(float $precision = 1) Truncate the current instance hour with given precision. - * @method $this ceilHour(float $precision = 1) Ceil the current instance hour with given precision. - * @method $this ceilHours(float $precision = 1) Ceil the current instance hour with given precision. - * @method $this roundMinute(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. - * @method $this roundMinutes(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. - * @method $this floorMinute(float $precision = 1) Truncate the current instance minute with given precision. - * @method $this floorMinutes(float $precision = 1) Truncate the current instance minute with given precision. - * @method $this ceilMinute(float $precision = 1) Ceil the current instance minute with given precision. - * @method $this ceilMinutes(float $precision = 1) Ceil the current instance minute with given precision. - * @method $this roundSecond(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. - * @method $this roundSeconds(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. - * @method $this floorSecond(float $precision = 1) Truncate the current instance second with given precision. - * @method $this floorSeconds(float $precision = 1) Truncate the current instance second with given precision. - * @method $this ceilSecond(float $precision = 1) Ceil the current instance second with given precision. - * @method $this ceilSeconds(float $precision = 1) Ceil the current instance second with given precision. - * @method $this roundMillennium(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. - * @method $this roundMillennia(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. - * @method $this floorMillennium(float $precision = 1) Truncate the current instance millennium with given precision. - * @method $this floorMillennia(float $precision = 1) Truncate the current instance millennium with given precision. - * @method $this ceilMillennium(float $precision = 1) Ceil the current instance millennium with given precision. - * @method $this ceilMillennia(float $precision = 1) Ceil the current instance millennium with given precision. - * @method $this roundCentury(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. - * @method $this roundCenturies(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. - * @method $this floorCentury(float $precision = 1) Truncate the current instance century with given precision. - * @method $this floorCenturies(float $precision = 1) Truncate the current instance century with given precision. - * @method $this ceilCentury(float $precision = 1) Ceil the current instance century with given precision. - * @method $this ceilCenturies(float $precision = 1) Ceil the current instance century with given precision. - * @method $this roundDecade(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. - * @method $this roundDecades(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. - * @method $this floorDecade(float $precision = 1) Truncate the current instance decade with given precision. - * @method $this floorDecades(float $precision = 1) Truncate the current instance decade with given precision. - * @method $this ceilDecade(float $precision = 1) Ceil the current instance decade with given precision. - * @method $this ceilDecades(float $precision = 1) Ceil the current instance decade with given precision. - * @method $this roundQuarter(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. - * @method $this roundQuarters(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. - * @method $this floorQuarter(float $precision = 1) Truncate the current instance quarter with given precision. - * @method $this floorQuarters(float $precision = 1) Truncate the current instance quarter with given precision. - * @method $this ceilQuarter(float $precision = 1) Ceil the current instance quarter with given precision. - * @method $this ceilQuarters(float $precision = 1) Ceil the current instance quarter with given precision. - * @method $this roundMillisecond(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. - * @method $this roundMilliseconds(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. - * @method $this floorMillisecond(float $precision = 1) Truncate the current instance millisecond with given precision. - * @method $this floorMilliseconds(float $precision = 1) Truncate the current instance millisecond with given precision. - * @method $this ceilMillisecond(float $precision = 1) Ceil the current instance millisecond with given precision. - * @method $this ceilMilliseconds(float $precision = 1) Ceil the current instance millisecond with given precision. - * @method $this roundMicrosecond(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. - * @method $this roundMicroseconds(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. - * @method $this floorMicrosecond(float $precision = 1) Truncate the current instance microsecond with given precision. - * @method $this floorMicroseconds(float $precision = 1) Truncate the current instance microsecond with given precision. - * @method $this ceilMicrosecond(float $precision = 1) Ceil the current instance microsecond with given precision. - * @method $this ceilMicroseconds(float $precision = 1) Ceil the current instance microsecond with given precision. - * @method string shortAbsoluteDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'Absolute' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) - * @method string longAbsoluteDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'Absolute' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) - * @method string shortRelativeDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'Relative' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) - * @method string longRelativeDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'Relative' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) - * @method string shortRelativeToNowDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) - * @method string longRelativeToNowDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) - * @method string shortRelativeToOtherDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) - * @method string longRelativeToOtherDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) - * @method static Carbon|false createFromFormat(string $format, string $time, string|DateTimeZone $timezone = null) Parse a string into a new Carbon object according to the specified format. - * @method static Carbon __set_state(array $array) https://php.net/manual/en/datetime.set-state.php + * @method bool isUtc() Check if the current instance has UTC timezone. (Both isUtc and isUTC cases are valid.) + * @method bool isLocal() Check if the current instance has non-UTC timezone. + * @method bool isValid() Check if the current instance is a valid date. + * @method bool isDST() Check if the current instance is in a daylight saving time. + * @method bool isSunday() Checks if the instance day is sunday. + * @method bool isMonday() Checks if the instance day is monday. + * @method bool isTuesday() Checks if the instance day is tuesday. + * @method bool isWednesday() Checks if the instance day is wednesday. + * @method bool isThursday() Checks if the instance day is thursday. + * @method bool isFriday() Checks if the instance day is friday. + * @method bool isSaturday() Checks if the instance day is saturday. + * @method bool isSameYear(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same year as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentYear() Checks if the instance is in the same year as the current moment. + * @method bool isNextYear() Checks if the instance is in the same year as the current moment next year. + * @method bool isLastYear() Checks if the instance is in the same year as the current moment last year. + * @method bool isSameWeek(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same week as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentWeek() Checks if the instance is in the same week as the current moment. + * @method bool isNextWeek() Checks if the instance is in the same week as the current moment next week. + * @method bool isLastWeek() Checks if the instance is in the same week as the current moment last week. + * @method bool isSameDay(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same day as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentDay() Checks if the instance is in the same day as the current moment. + * @method bool isNextDay() Checks if the instance is in the same day as the current moment next day. + * @method bool isLastDay() Checks if the instance is in the same day as the current moment last day. + * @method bool isSameHour(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same hour as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentHour() Checks if the instance is in the same hour as the current moment. + * @method bool isNextHour() Checks if the instance is in the same hour as the current moment next hour. + * @method bool isLastHour() Checks if the instance is in the same hour as the current moment last hour. + * @method bool isSameMinute(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same minute as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMinute() Checks if the instance is in the same minute as the current moment. + * @method bool isNextMinute() Checks if the instance is in the same minute as the current moment next minute. + * @method bool isLastMinute() Checks if the instance is in the same minute as the current moment last minute. + * @method bool isSameSecond(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same second as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentSecond() Checks if the instance is in the same second as the current moment. + * @method bool isNextSecond() Checks if the instance is in the same second as the current moment next second. + * @method bool isLastSecond() Checks if the instance is in the same second as the current moment last second. + * @method bool isSameMicro(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMicro() Checks if the instance is in the same microsecond as the current moment. + * @method bool isNextMicro() Checks if the instance is in the same microsecond as the current moment next microsecond. + * @method bool isLastMicro() Checks if the instance is in the same microsecond as the current moment last microsecond. + * @method bool isSameMicrosecond(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMicrosecond() Checks if the instance is in the same microsecond as the current moment. + * @method bool isNextMicrosecond() Checks if the instance is in the same microsecond as the current moment next microsecond. + * @method bool isLastMicrosecond() Checks if the instance is in the same microsecond as the current moment last microsecond. + * @method bool isCurrentMonth() Checks if the instance is in the same month as the current moment. + * @method bool isNextMonth() Checks if the instance is in the same month as the current moment next month. + * @method bool isLastMonth() Checks if the instance is in the same month as the current moment last month. + * @method bool isCurrentQuarter() Checks if the instance is in the same quarter as the current moment. + * @method bool isNextQuarter() Checks if the instance is in the same quarter as the current moment next quarter. + * @method bool isLastQuarter() Checks if the instance is in the same quarter as the current moment last quarter. + * @method bool isSameDecade(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same decade as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentDecade() Checks if the instance is in the same decade as the current moment. + * @method bool isNextDecade() Checks if the instance is in the same decade as the current moment next decade. + * @method bool isLastDecade() Checks if the instance is in the same decade as the current moment last decade. + * @method bool isSameCentury(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same century as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentCentury() Checks if the instance is in the same century as the current moment. + * @method bool isNextCentury() Checks if the instance is in the same century as the current moment next century. + * @method bool isLastCentury() Checks if the instance is in the same century as the current moment last century. + * @method bool isSameMillennium(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same millennium as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMillennium() Checks if the instance is in the same millennium as the current moment. + * @method bool isNextMillennium() Checks if the instance is in the same millennium as the current moment next millennium. + * @method bool isLastMillennium() Checks if the instance is in the same millennium as the current moment last millennium. + * @method $this years(int $value) Set current instance year to the given value. + * @method $this year(int $value) Set current instance year to the given value. + * @method $this setYears(int $value) Set current instance year to the given value. + * @method $this setYear(int $value) Set current instance year to the given value. + * @method $this months(int $value) Set current instance month to the given value. + * @method $this month(int $value) Set current instance month to the given value. + * @method $this setMonths(int $value) Set current instance month to the given value. + * @method $this setMonth(int $value) Set current instance month to the given value. + * @method $this days(int $value) Set current instance day to the given value. + * @method $this day(int $value) Set current instance day to the given value. + * @method $this setDays(int $value) Set current instance day to the given value. + * @method $this setDay(int $value) Set current instance day to the given value. + * @method $this hours(int $value) Set current instance hour to the given value. + * @method $this hour(int $value) Set current instance hour to the given value. + * @method $this setHours(int $value) Set current instance hour to the given value. + * @method $this setHour(int $value) Set current instance hour to the given value. + * @method $this minutes(int $value) Set current instance minute to the given value. + * @method $this minute(int $value) Set current instance minute to the given value. + * @method $this setMinutes(int $value) Set current instance minute to the given value. + * @method $this setMinute(int $value) Set current instance minute to the given value. + * @method $this seconds(int $value) Set current instance second to the given value. + * @method $this second(int $value) Set current instance second to the given value. + * @method $this setSeconds(int $value) Set current instance second to the given value. + * @method $this setSecond(int $value) Set current instance second to the given value. + * @method $this millis(int $value) Set current instance millisecond to the given value. + * @method $this milli(int $value) Set current instance millisecond to the given value. + * @method $this setMillis(int $value) Set current instance millisecond to the given value. + * @method $this setMilli(int $value) Set current instance millisecond to the given value. + * @method $this milliseconds(int $value) Set current instance millisecond to the given value. + * @method $this millisecond(int $value) Set current instance millisecond to the given value. + * @method $this setMilliseconds(int $value) Set current instance millisecond to the given value. + * @method $this setMillisecond(int $value) Set current instance millisecond to the given value. + * @method $this micros(int $value) Set current instance microsecond to the given value. + * @method $this micro(int $value) Set current instance microsecond to the given value. + * @method $this setMicros(int $value) Set current instance microsecond to the given value. + * @method $this setMicro(int $value) Set current instance microsecond to the given value. + * @method $this microseconds(int $value) Set current instance microsecond to the given value. + * @method $this microsecond(int $value) Set current instance microsecond to the given value. + * @method $this setMicroseconds(int $value) Set current instance microsecond to the given value. + * @method $this setMicrosecond(int $value) Set current instance microsecond to the given value. + * @method $this addYears(int $value = 1) Add years (the $value count passed in) to the instance (using date interval). + * @method $this addYear() Add one year to the instance (using date interval). + * @method $this subYears(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval). + * @method $this subYear() Sub one year to the instance (using date interval). + * @method $this addYearsWithOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method $this addYearWithOverflow() Add one year to the instance (using date interval) with overflow explicitly allowed. + * @method $this subYearsWithOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method $this subYearWithOverflow() Sub one year to the instance (using date interval) with overflow explicitly allowed. + * @method $this addYearsWithoutOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addYearWithoutOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subYearsWithoutOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subYearWithoutOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addYearsWithNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addYearWithNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subYearsWithNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subYearWithNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addYearsNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addYearNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subYearsNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subYearNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addMonths(int $value = 1) Add months (the $value count passed in) to the instance (using date interval). + * @method $this addMonth() Add one month to the instance (using date interval). + * @method $this subMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval). + * @method $this subMonth() Sub one month to the instance (using date interval). + * @method $this addMonthsWithOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method $this addMonthWithOverflow() Add one month to the instance (using date interval) with overflow explicitly allowed. + * @method $this subMonthsWithOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method $this subMonthWithOverflow() Sub one month to the instance (using date interval) with overflow explicitly allowed. + * @method $this addMonthsWithoutOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addMonthWithoutOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subMonthsWithoutOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subMonthWithoutOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addMonthsWithNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addMonthWithNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subMonthsWithNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subMonthWithNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addMonthsNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addMonthNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subMonthsNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subMonthNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addDays(int $value = 1) Add days (the $value count passed in) to the instance (using date interval). + * @method $this addDay() Add one day to the instance (using date interval). + * @method $this subDays(int $value = 1) Sub days (the $value count passed in) to the instance (using date interval). + * @method $this subDay() Sub one day to the instance (using date interval). + * @method $this addHours(int $value = 1) Add hours (the $value count passed in) to the instance (using date interval). + * @method $this addHour() Add one hour to the instance (using date interval). + * @method $this subHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using date interval). + * @method $this subHour() Sub one hour to the instance (using date interval). + * @method $this addMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using date interval). + * @method $this addMinute() Add one minute to the instance (using date interval). + * @method $this subMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using date interval). + * @method $this subMinute() Sub one minute to the instance (using date interval). + * @method $this addSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using date interval). + * @method $this addSecond() Add one second to the instance (using date interval). + * @method $this subSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using date interval). + * @method $this subSecond() Sub one second to the instance (using date interval). + * @method $this addMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). + * @method $this addMilli() Add one millisecond to the instance (using date interval). + * @method $this subMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). + * @method $this subMilli() Sub one millisecond to the instance (using date interval). + * @method $this addMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). + * @method $this addMillisecond() Add one millisecond to the instance (using date interval). + * @method $this subMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). + * @method $this subMillisecond() Sub one millisecond to the instance (using date interval). + * @method $this addMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). + * @method $this addMicro() Add one microsecond to the instance (using date interval). + * @method $this subMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). + * @method $this subMicro() Sub one microsecond to the instance (using date interval). + * @method $this addMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). + * @method $this addMicrosecond() Add one microsecond to the instance (using date interval). + * @method $this subMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). + * @method $this subMicrosecond() Sub one microsecond to the instance (using date interval). + * @method $this addMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval). + * @method $this addMillennium() Add one millennium to the instance (using date interval). + * @method $this subMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval). + * @method $this subMillennium() Sub one millennium to the instance (using date interval). + * @method $this addMillenniaWithOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method $this addMillenniumWithOverflow() Add one millennium to the instance (using date interval) with overflow explicitly allowed. + * @method $this subMillenniaWithOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method $this subMillenniumWithOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly allowed. + * @method $this addMillenniaWithoutOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addMillenniumWithoutOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subMillenniaWithoutOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subMillenniumWithoutOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addMillenniaWithNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addMillenniumWithNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subMillenniaWithNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subMillenniumWithNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addMillenniaNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addMillenniumNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subMillenniaNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subMillenniumNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval). + * @method $this addCentury() Add one century to the instance (using date interval). + * @method $this subCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval). + * @method $this subCentury() Sub one century to the instance (using date interval). + * @method $this addCenturiesWithOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method $this addCenturyWithOverflow() Add one century to the instance (using date interval) with overflow explicitly allowed. + * @method $this subCenturiesWithOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method $this subCenturyWithOverflow() Sub one century to the instance (using date interval) with overflow explicitly allowed. + * @method $this addCenturiesWithoutOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addCenturyWithoutOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subCenturiesWithoutOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subCenturyWithoutOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addCenturiesWithNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addCenturyWithNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subCenturiesWithNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subCenturyWithNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addCenturiesNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addCenturyNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subCenturiesNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subCenturyNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval). + * @method $this addDecade() Add one decade to the instance (using date interval). + * @method $this subDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval). + * @method $this subDecade() Sub one decade to the instance (using date interval). + * @method $this addDecadesWithOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method $this addDecadeWithOverflow() Add one decade to the instance (using date interval) with overflow explicitly allowed. + * @method $this subDecadesWithOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method $this subDecadeWithOverflow() Sub one decade to the instance (using date interval) with overflow explicitly allowed. + * @method $this addDecadesWithoutOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addDecadeWithoutOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subDecadesWithoutOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subDecadeWithoutOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addDecadesWithNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addDecadeWithNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subDecadesWithNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subDecadeWithNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addDecadesNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addDecadeNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subDecadesNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subDecadeNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval). + * @method $this addQuarter() Add one quarter to the instance (using date interval). + * @method $this subQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval). + * @method $this subQuarter() Sub one quarter to the instance (using date interval). + * @method $this addQuartersWithOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method $this addQuarterWithOverflow() Add one quarter to the instance (using date interval) with overflow explicitly allowed. + * @method $this subQuartersWithOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method $this subQuarterWithOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly allowed. + * @method $this addQuartersWithoutOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addQuarterWithoutOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subQuartersWithoutOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subQuarterWithoutOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addQuartersWithNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addQuarterWithNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subQuartersWithNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subQuarterWithNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addQuartersNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addQuarterNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subQuartersNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method $this subQuarterNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method $this addWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using date interval). + * @method $this addWeek() Add one week to the instance (using date interval). + * @method $this subWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using date interval). + * @method $this subWeek() Sub one week to the instance (using date interval). + * @method $this addWeekdays(int $value = 1) Add weekdays (the $value count passed in) to the instance (using date interval). + * @method $this addWeekday() Add one weekday to the instance (using date interval). + * @method $this subWeekdays(int $value = 1) Sub weekdays (the $value count passed in) to the instance (using date interval). + * @method $this subWeekday() Sub one weekday to the instance (using date interval). + * @method $this addRealMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). + * @method $this addRealMicro() Add one microsecond to the instance (using timestamp). + * @method $this subRealMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). + * @method $this subRealMicro() Sub one microsecond to the instance (using timestamp). + * @method CarbonPeriod microsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given. + * @method $this addRealMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). + * @method $this addRealMicrosecond() Add one microsecond to the instance (using timestamp). + * @method $this subRealMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). + * @method $this subRealMicrosecond() Sub one microsecond to the instance (using timestamp). + * @method CarbonPeriod microsecondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given. + * @method $this addRealMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). + * @method $this addRealMilli() Add one millisecond to the instance (using timestamp). + * @method $this subRealMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). + * @method $this subRealMilli() Sub one millisecond to the instance (using timestamp). + * @method CarbonPeriod millisUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given. + * @method $this addRealMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). + * @method $this addRealMillisecond() Add one millisecond to the instance (using timestamp). + * @method $this subRealMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). + * @method $this subRealMillisecond() Sub one millisecond to the instance (using timestamp). + * @method CarbonPeriod millisecondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given. + * @method $this addRealSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using timestamp). + * @method $this addRealSecond() Add one second to the instance (using timestamp). + * @method $this subRealSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using timestamp). + * @method $this subRealSecond() Sub one second to the instance (using timestamp). + * @method CarbonPeriod secondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each second or every X seconds if a factor is given. + * @method $this addRealMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using timestamp). + * @method $this addRealMinute() Add one minute to the instance (using timestamp). + * @method $this subRealMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using timestamp). + * @method $this subRealMinute() Sub one minute to the instance (using timestamp). + * @method CarbonPeriod minutesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each minute or every X minutes if a factor is given. + * @method $this addRealHours(int $value = 1) Add hours (the $value count passed in) to the instance (using timestamp). + * @method $this addRealHour() Add one hour to the instance (using timestamp). + * @method $this subRealHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using timestamp). + * @method $this subRealHour() Sub one hour to the instance (using timestamp). + * @method CarbonPeriod hoursUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each hour or every X hours if a factor is given. + * @method $this addRealDays(int $value = 1) Add days (the $value count passed in) to the instance (using timestamp). + * @method $this addRealDay() Add one day to the instance (using timestamp). + * @method $this subRealDays(int $value = 1) Sub days (the $value count passed in) to the instance (using timestamp). + * @method $this subRealDay() Sub one day to the instance (using timestamp). + * @method CarbonPeriod daysUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each day or every X days if a factor is given. + * @method $this addRealWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using timestamp). + * @method $this addRealWeek() Add one week to the instance (using timestamp). + * @method $this subRealWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using timestamp). + * @method $this subRealWeek() Sub one week to the instance (using timestamp). + * @method CarbonPeriod weeksUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each week or every X weeks if a factor is given. + * @method $this addRealMonths(int $value = 1) Add months (the $value count passed in) to the instance (using timestamp). + * @method $this addRealMonth() Add one month to the instance (using timestamp). + * @method $this subRealMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using timestamp). + * @method $this subRealMonth() Sub one month to the instance (using timestamp). + * @method CarbonPeriod monthsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each month or every X months if a factor is given. + * @method $this addRealQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using timestamp). + * @method $this addRealQuarter() Add one quarter to the instance (using timestamp). + * @method $this subRealQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using timestamp). + * @method $this subRealQuarter() Sub one quarter to the instance (using timestamp). + * @method CarbonPeriod quartersUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each quarter or every X quarters if a factor is given. + * @method $this addRealYears(int $value = 1) Add years (the $value count passed in) to the instance (using timestamp). + * @method $this addRealYear() Add one year to the instance (using timestamp). + * @method $this subRealYears(int $value = 1) Sub years (the $value count passed in) to the instance (using timestamp). + * @method $this subRealYear() Sub one year to the instance (using timestamp). + * @method CarbonPeriod yearsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each year or every X years if a factor is given. + * @method $this addRealDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using timestamp). + * @method $this addRealDecade() Add one decade to the instance (using timestamp). + * @method $this subRealDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using timestamp). + * @method $this subRealDecade() Sub one decade to the instance (using timestamp). + * @method CarbonPeriod decadesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each decade or every X decades if a factor is given. + * @method $this addRealCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using timestamp). + * @method $this addRealCentury() Add one century to the instance (using timestamp). + * @method $this subRealCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using timestamp). + * @method $this subRealCentury() Sub one century to the instance (using timestamp). + * @method CarbonPeriod centuriesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each century or every X centuries if a factor is given. + * @method $this addRealMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using timestamp). + * @method $this addRealMillennium() Add one millennium to the instance (using timestamp). + * @method $this subRealMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using timestamp). + * @method $this subRealMillennium() Sub one millennium to the instance (using timestamp). + * @method CarbonPeriod millenniaUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millennium or every X millennia if a factor is given. + * @method $this roundYear(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. + * @method $this roundYears(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. + * @method $this floorYear(float $precision = 1) Truncate the current instance year with given precision. + * @method $this floorYears(float $precision = 1) Truncate the current instance year with given precision. + * @method $this ceilYear(float $precision = 1) Ceil the current instance year with given precision. + * @method $this ceilYears(float $precision = 1) Ceil the current instance year with given precision. + * @method $this roundMonth(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. + * @method $this roundMonths(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. + * @method $this floorMonth(float $precision = 1) Truncate the current instance month with given precision. + * @method $this floorMonths(float $precision = 1) Truncate the current instance month with given precision. + * @method $this ceilMonth(float $precision = 1) Ceil the current instance month with given precision. + * @method $this ceilMonths(float $precision = 1) Ceil the current instance month with given precision. + * @method $this roundDay(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method $this roundDays(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method $this floorDay(float $precision = 1) Truncate the current instance day with given precision. + * @method $this floorDays(float $precision = 1) Truncate the current instance day with given precision. + * @method $this ceilDay(float $precision = 1) Ceil the current instance day with given precision. + * @method $this ceilDays(float $precision = 1) Ceil the current instance day with given precision. + * @method $this roundHour(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. + * @method $this roundHours(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. + * @method $this floorHour(float $precision = 1) Truncate the current instance hour with given precision. + * @method $this floorHours(float $precision = 1) Truncate the current instance hour with given precision. + * @method $this ceilHour(float $precision = 1) Ceil the current instance hour with given precision. + * @method $this ceilHours(float $precision = 1) Ceil the current instance hour with given precision. + * @method $this roundMinute(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. + * @method $this roundMinutes(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. + * @method $this floorMinute(float $precision = 1) Truncate the current instance minute with given precision. + * @method $this floorMinutes(float $precision = 1) Truncate the current instance minute with given precision. + * @method $this ceilMinute(float $precision = 1) Ceil the current instance minute with given precision. + * @method $this ceilMinutes(float $precision = 1) Ceil the current instance minute with given precision. + * @method $this roundSecond(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. + * @method $this roundSeconds(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. + * @method $this floorSecond(float $precision = 1) Truncate the current instance second with given precision. + * @method $this floorSeconds(float $precision = 1) Truncate the current instance second with given precision. + * @method $this ceilSecond(float $precision = 1) Ceil the current instance second with given precision. + * @method $this ceilSeconds(float $precision = 1) Ceil the current instance second with given precision. + * @method $this roundMillennium(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. + * @method $this roundMillennia(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. + * @method $this floorMillennium(float $precision = 1) Truncate the current instance millennium with given precision. + * @method $this floorMillennia(float $precision = 1) Truncate the current instance millennium with given precision. + * @method $this ceilMillennium(float $precision = 1) Ceil the current instance millennium with given precision. + * @method $this ceilMillennia(float $precision = 1) Ceil the current instance millennium with given precision. + * @method $this roundCentury(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. + * @method $this roundCenturies(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. + * @method $this floorCentury(float $precision = 1) Truncate the current instance century with given precision. + * @method $this floorCenturies(float $precision = 1) Truncate the current instance century with given precision. + * @method $this ceilCentury(float $precision = 1) Ceil the current instance century with given precision. + * @method $this ceilCenturies(float $precision = 1) Ceil the current instance century with given precision. + * @method $this roundDecade(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. + * @method $this roundDecades(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. + * @method $this floorDecade(float $precision = 1) Truncate the current instance decade with given precision. + * @method $this floorDecades(float $precision = 1) Truncate the current instance decade with given precision. + * @method $this ceilDecade(float $precision = 1) Ceil the current instance decade with given precision. + * @method $this ceilDecades(float $precision = 1) Ceil the current instance decade with given precision. + * @method $this roundQuarter(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. + * @method $this roundQuarters(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. + * @method $this floorQuarter(float $precision = 1) Truncate the current instance quarter with given precision. + * @method $this floorQuarters(float $precision = 1) Truncate the current instance quarter with given precision. + * @method $this ceilQuarter(float $precision = 1) Ceil the current instance quarter with given precision. + * @method $this ceilQuarters(float $precision = 1) Ceil the current instance quarter with given precision. + * @method $this roundMillisecond(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. + * @method $this roundMilliseconds(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. + * @method $this floorMillisecond(float $precision = 1) Truncate the current instance millisecond with given precision. + * @method $this floorMilliseconds(float $precision = 1) Truncate the current instance millisecond with given precision. + * @method $this ceilMillisecond(float $precision = 1) Ceil the current instance millisecond with given precision. + * @method $this ceilMilliseconds(float $precision = 1) Ceil the current instance millisecond with given precision. + * @method $this roundMicrosecond(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. + * @method $this roundMicroseconds(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. + * @method $this floorMicrosecond(float $precision = 1) Truncate the current instance microsecond with given precision. + * @method $this floorMicroseconds(float $precision = 1) Truncate the current instance microsecond with given precision. + * @method $this ceilMicrosecond(float $precision = 1) Ceil the current instance microsecond with given precision. + * @method $this ceilMicroseconds(float $precision = 1) Ceil the current instance microsecond with given precision. + * @method string shortAbsoluteDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'Absolute' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longAbsoluteDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'Absolute' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string shortRelativeDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'Relative' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longRelativeDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'Relative' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string shortRelativeToNowDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longRelativeToNowDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string shortRelativeToOtherDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longRelativeToOtherDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method static static|false createFromFormat(string $format, string $time, DateTimeZone|string|false|null $timezone = null) Parse a string into a new Carbon object according to the specified format. + * @method static static __set_state(array $array) https://php.net/manual/en/datetime.set-state.php * * */ diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/CarbonImmutable.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/CarbonImmutable.php index 6d1194ee7..4c9c1cfef 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/CarbonImmutable.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/CarbonImmutable.php @@ -24,486 +24,486 @@ use DateTimeZone; * * * - * @property int $year - * @property int $yearIso - * @property int $month - * @property int $day - * @property int $hour - * @property int $minute - * @property int $second - * @property int $micro - * @property int $microsecond - * @property int|float|string $timestamp seconds since the Unix Epoch - * @property string $englishDayOfWeek the day of week in English - * @property string $shortEnglishDayOfWeek the abbreviated day of week in English - * @property string $englishMonth the month in English - * @property string $shortEnglishMonth the abbreviated month in English - * @property int $milliseconds - * @property int $millisecond - * @property int $milli - * @property int $week 1 through 53 - * @property int $isoWeek 1 through 53 - * @property int $weekYear year according to week format - * @property int $isoWeekYear year according to ISO week format - * @property int $dayOfYear 1 through 366 - * @property int $age does a diffInYears() with default parameters - * @property int $offset the timezone offset in seconds from UTC - * @property int $offsetMinutes the timezone offset in minutes from UTC - * @property int $offsetHours the timezone offset in hours from UTC - * @property CarbonTimeZone $timezone the current timezone - * @property CarbonTimeZone $tz alias of $timezone - * @property-read int $dayOfWeek 0 (for Sunday) through 6 (for Saturday) - * @property-read int $dayOfWeekIso 1 (for Monday) through 7 (for Sunday) - * @property-read int $weekOfYear ISO-8601 week number of year, weeks starting on Monday - * @property-read int $daysInMonth number of days in the given month - * @property-read string $latinMeridiem "am"/"pm" (Ante meridiem or Post meridiem latin lowercase mark) - * @property-read string $latinUpperMeridiem "AM"/"PM" (Ante meridiem or Post meridiem latin uppercase mark) - * @property-read string $timezoneAbbreviatedName the current timezone abbreviated name - * @property-read string $tzAbbrName alias of $timezoneAbbreviatedName - * @property-read string $dayName long name of weekday translated according to Carbon locale, in english if no translation available for current language - * @property-read string $shortDayName short name of weekday translated according to Carbon locale, in english if no translation available for current language - * @property-read string $minDayName very short name of weekday translated according to Carbon locale, in english if no translation available for current language - * @property-read string $monthName long name of month translated according to Carbon locale, in english if no translation available for current language - * @property-read string $shortMonthName short name of month translated according to Carbon locale, in english if no translation available for current language - * @property-read string $meridiem lowercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language - * @property-read string $upperMeridiem uppercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language - * @property-read int $noZeroHour current hour from 1 to 24 - * @property-read int $weeksInYear 51 through 53 - * @property-read int $isoWeeksInYear 51 through 53 - * @property-read int $weekOfMonth 1 through 5 - * @property-read int $weekNumberInMonth 1 through 5 - * @property-read int $firstWeekDay 0 through 6 - * @property-read int $lastWeekDay 0 through 6 - * @property-read int $daysInYear 365 or 366 - * @property-read int $quarter the quarter of this instance, 1 - 4 - * @property-read int $decade the decade of this instance - * @property-read int $century the century of this instance - * @property-read int $millennium the millennium of this instance - * @property-read bool $dst daylight savings time indicator, true if DST, false otherwise - * @property-read bool $local checks if the timezone is local, true if local, false otherwise - * @property-read bool $utc checks if the timezone is UTC, true if UTC, false otherwise - * @property-read string $timezoneName the current timezone name - * @property-read string $tzName alias of $timezoneName - * @property-read string $locale locale of the current instance + * @property int $year + * @property int $yearIso + * @property int $month + * @property int $day + * @property int $hour + * @property int $minute + * @property int $second + * @property int $micro + * @property int $microsecond + * @property int|float|string $timestamp seconds since the Unix Epoch + * @property string $englishDayOfWeek the day of week in English + * @property string $shortEnglishDayOfWeek the abbreviated day of week in English + * @property string $englishMonth the month in English + * @property string $shortEnglishMonth the abbreviated month in English + * @property int $milliseconds + * @property int $millisecond + * @property int $milli + * @property int $week 1 through 53 + * @property int $isoWeek 1 through 53 + * @property int $weekYear year according to week format + * @property int $isoWeekYear year according to ISO week format + * @property int $dayOfYear 1 through 366 + * @property int $age does a diffInYears() with default parameters + * @property int $offset the timezone offset in seconds from UTC + * @property int $offsetMinutes the timezone offset in minutes from UTC + * @property int $offsetHours the timezone offset in hours from UTC + * @property CarbonTimeZone $timezone the current timezone + * @property CarbonTimeZone $tz alias of $timezone + * @property-read int $dayOfWeek 0 (for Sunday) through 6 (for Saturday) + * @property-read int $dayOfWeekIso 1 (for Monday) through 7 (for Sunday) + * @property-read int $weekOfYear ISO-8601 week number of year, weeks starting on Monday + * @property-read int $daysInMonth number of days in the given month + * @property-read string $latinMeridiem "am"/"pm" (Ante meridiem or Post meridiem latin lowercase mark) + * @property-read string $latinUpperMeridiem "AM"/"PM" (Ante meridiem or Post meridiem latin uppercase mark) + * @property-read string $timezoneAbbreviatedName the current timezone abbreviated name + * @property-read string $tzAbbrName alias of $timezoneAbbreviatedName + * @property-read string $dayName long name of weekday translated according to Carbon locale, in english if no translation available for current language + * @property-read string $shortDayName short name of weekday translated according to Carbon locale, in english if no translation available for current language + * @property-read string $minDayName very short name of weekday translated according to Carbon locale, in english if no translation available for current language + * @property-read string $monthName long name of month translated according to Carbon locale, in english if no translation available for current language + * @property-read string $shortMonthName short name of month translated according to Carbon locale, in english if no translation available for current language + * @property-read string $meridiem lowercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language + * @property-read string $upperMeridiem uppercase meridiem mark translated according to Carbon locale, in latin if no translation available for current language + * @property-read int $noZeroHour current hour from 1 to 24 + * @property-read int $weeksInYear 51 through 53 + * @property-read int $isoWeeksInYear 51 through 53 + * @property-read int $weekOfMonth 1 through 5 + * @property-read int $weekNumberInMonth 1 through 5 + * @property-read int $firstWeekDay 0 through 6 + * @property-read int $lastWeekDay 0 through 6 + * @property-read int $daysInYear 365 or 366 + * @property-read int $quarter the quarter of this instance, 1 - 4 + * @property-read int $decade the decade of this instance + * @property-read int $century the century of this instance + * @property-read int $millennium the millennium of this instance + * @property-read bool $dst daylight savings time indicator, true if DST, false otherwise + * @property-read bool $local checks if the timezone is local, true if local, false otherwise + * @property-read bool $utc checks if the timezone is UTC, true if UTC, false otherwise + * @property-read string $timezoneName the current timezone name + * @property-read string $tzName alias of $timezoneName + * @property-read string $locale locale of the current instance * - * @method bool isUtc() Check if the current instance has UTC timezone. (Both isUtc and isUTC cases are valid.) - * @method bool isLocal() Check if the current instance has non-UTC timezone. - * @method bool isValid() Check if the current instance is a valid date. - * @method bool isDST() Check if the current instance is in a daylight saving time. - * @method bool isSunday() Checks if the instance day is sunday. - * @method bool isMonday() Checks if the instance day is monday. - * @method bool isTuesday() Checks if the instance day is tuesday. - * @method bool isWednesday() Checks if the instance day is wednesday. - * @method bool isThursday() Checks if the instance day is thursday. - * @method bool isFriday() Checks if the instance day is friday. - * @method bool isSaturday() Checks if the instance day is saturday. - * @method bool isSameYear(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same year as the instance. If null passed, compare to now (with the same timezone). - * @method bool isCurrentYear() Checks if the instance is in the same year as the current moment. - * @method bool isNextYear() Checks if the instance is in the same year as the current moment next year. - * @method bool isLastYear() Checks if the instance is in the same year as the current moment last year. - * @method bool isSameWeek(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same week as the instance. If null passed, compare to now (with the same timezone). - * @method bool isCurrentWeek() Checks if the instance is in the same week as the current moment. - * @method bool isNextWeek() Checks if the instance is in the same week as the current moment next week. - * @method bool isLastWeek() Checks if the instance is in the same week as the current moment last week. - * @method bool isSameDay(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same day as the instance. If null passed, compare to now (with the same timezone). - * @method bool isCurrentDay() Checks if the instance is in the same day as the current moment. - * @method bool isNextDay() Checks if the instance is in the same day as the current moment next day. - * @method bool isLastDay() Checks if the instance is in the same day as the current moment last day. - * @method bool isSameHour(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same hour as the instance. If null passed, compare to now (with the same timezone). - * @method bool isCurrentHour() Checks if the instance is in the same hour as the current moment. - * @method bool isNextHour() Checks if the instance is in the same hour as the current moment next hour. - * @method bool isLastHour() Checks if the instance is in the same hour as the current moment last hour. - * @method bool isSameMinute(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same minute as the instance. If null passed, compare to now (with the same timezone). - * @method bool isCurrentMinute() Checks if the instance is in the same minute as the current moment. - * @method bool isNextMinute() Checks if the instance is in the same minute as the current moment next minute. - * @method bool isLastMinute() Checks if the instance is in the same minute as the current moment last minute. - * @method bool isSameSecond(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same second as the instance. If null passed, compare to now (with the same timezone). - * @method bool isCurrentSecond() Checks if the instance is in the same second as the current moment. - * @method bool isNextSecond() Checks if the instance is in the same second as the current moment next second. - * @method bool isLastSecond() Checks if the instance is in the same second as the current moment last second. - * @method bool isSameMicro(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone). - * @method bool isCurrentMicro() Checks if the instance is in the same microsecond as the current moment. - * @method bool isNextMicro() Checks if the instance is in the same microsecond as the current moment next microsecond. - * @method bool isLastMicro() Checks if the instance is in the same microsecond as the current moment last microsecond. - * @method bool isSameMicrosecond(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone). - * @method bool isCurrentMicrosecond() Checks if the instance is in the same microsecond as the current moment. - * @method bool isNextMicrosecond() Checks if the instance is in the same microsecond as the current moment next microsecond. - * @method bool isLastMicrosecond() Checks if the instance is in the same microsecond as the current moment last microsecond. - * @method bool isCurrentMonth() Checks if the instance is in the same month as the current moment. - * @method bool isNextMonth() Checks if the instance is in the same month as the current moment next month. - * @method bool isLastMonth() Checks if the instance is in the same month as the current moment last month. - * @method bool isCurrentQuarter() Checks if the instance is in the same quarter as the current moment. - * @method bool isNextQuarter() Checks if the instance is in the same quarter as the current moment next quarter. - * @method bool isLastQuarter() Checks if the instance is in the same quarter as the current moment last quarter. - * @method bool isSameDecade(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same decade as the instance. If null passed, compare to now (with the same timezone). - * @method bool isCurrentDecade() Checks if the instance is in the same decade as the current moment. - * @method bool isNextDecade() Checks if the instance is in the same decade as the current moment next decade. - * @method bool isLastDecade() Checks if the instance is in the same decade as the current moment last decade. - * @method bool isSameCentury(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same century as the instance. If null passed, compare to now (with the same timezone). - * @method bool isCurrentCentury() Checks if the instance is in the same century as the current moment. - * @method bool isNextCentury() Checks if the instance is in the same century as the current moment next century. - * @method bool isLastCentury() Checks if the instance is in the same century as the current moment last century. - * @method bool isSameMillennium(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same millennium as the instance. If null passed, compare to now (with the same timezone). - * @method bool isCurrentMillennium() Checks if the instance is in the same millennium as the current moment. - * @method bool isNextMillennium() Checks if the instance is in the same millennium as the current moment next millennium. - * @method bool isLastMillennium() Checks if the instance is in the same millennium as the current moment last millennium. - * @method CarbonImmutable years(int $value) Set current instance year to the given value. - * @method CarbonImmutable year(int $value) Set current instance year to the given value. - * @method CarbonImmutable setYears(int $value) Set current instance year to the given value. - * @method CarbonImmutable setYear(int $value) Set current instance year to the given value. - * @method CarbonImmutable months(int $value) Set current instance month to the given value. - * @method CarbonImmutable month(int $value) Set current instance month to the given value. - * @method CarbonImmutable setMonths(int $value) Set current instance month to the given value. - * @method CarbonImmutable setMonth(int $value) Set current instance month to the given value. - * @method CarbonImmutable days(int $value) Set current instance day to the given value. - * @method CarbonImmutable day(int $value) Set current instance day to the given value. - * @method CarbonImmutable setDays(int $value) Set current instance day to the given value. - * @method CarbonImmutable setDay(int $value) Set current instance day to the given value. - * @method CarbonImmutable hours(int $value) Set current instance hour to the given value. - * @method CarbonImmutable hour(int $value) Set current instance hour to the given value. - * @method CarbonImmutable setHours(int $value) Set current instance hour to the given value. - * @method CarbonImmutable setHour(int $value) Set current instance hour to the given value. - * @method CarbonImmutable minutes(int $value) Set current instance minute to the given value. - * @method CarbonImmutable minute(int $value) Set current instance minute to the given value. - * @method CarbonImmutable setMinutes(int $value) Set current instance minute to the given value. - * @method CarbonImmutable setMinute(int $value) Set current instance minute to the given value. - * @method CarbonImmutable seconds(int $value) Set current instance second to the given value. - * @method CarbonImmutable second(int $value) Set current instance second to the given value. - * @method CarbonImmutable setSeconds(int $value) Set current instance second to the given value. - * @method CarbonImmutable setSecond(int $value) Set current instance second to the given value. - * @method CarbonImmutable millis(int $value) Set current instance millisecond to the given value. - * @method CarbonImmutable milli(int $value) Set current instance millisecond to the given value. - * @method CarbonImmutable setMillis(int $value) Set current instance millisecond to the given value. - * @method CarbonImmutable setMilli(int $value) Set current instance millisecond to the given value. - * @method CarbonImmutable milliseconds(int $value) Set current instance millisecond to the given value. - * @method CarbonImmutable millisecond(int $value) Set current instance millisecond to the given value. - * @method CarbonImmutable setMilliseconds(int $value) Set current instance millisecond to the given value. - * @method CarbonImmutable setMillisecond(int $value) Set current instance millisecond to the given value. - * @method CarbonImmutable micros(int $value) Set current instance microsecond to the given value. - * @method CarbonImmutable micro(int $value) Set current instance microsecond to the given value. - * @method CarbonImmutable setMicros(int $value) Set current instance microsecond to the given value. - * @method CarbonImmutable setMicro(int $value) Set current instance microsecond to the given value. - * @method CarbonImmutable microseconds(int $value) Set current instance microsecond to the given value. - * @method CarbonImmutable microsecond(int $value) Set current instance microsecond to the given value. - * @method CarbonImmutable setMicroseconds(int $value) Set current instance microsecond to the given value. - * @method CarbonImmutable setMicrosecond(int $value) Set current instance microsecond to the given value. - * @method CarbonImmutable addYears(int $value = 1) Add years (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addYear() Add one year to the instance (using date interval). - * @method CarbonImmutable subYears(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subYear() Sub one year to the instance (using date interval). - * @method CarbonImmutable addYearsWithOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable addYearWithOverflow() Add one year to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable subYearsWithOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable subYearWithOverflow() Sub one year to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable addYearsWithoutOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addYearWithoutOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subYearsWithoutOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subYearWithoutOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addYearsWithNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addYearWithNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subYearsWithNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subYearWithNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addYearsNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addYearNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subYearsNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subYearNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addMonths(int $value = 1) Add months (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addMonth() Add one month to the instance (using date interval). - * @method CarbonImmutable subMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subMonth() Sub one month to the instance (using date interval). - * @method CarbonImmutable addMonthsWithOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable addMonthWithOverflow() Add one month to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable subMonthsWithOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable subMonthWithOverflow() Sub one month to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable addMonthsWithoutOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addMonthWithoutOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subMonthsWithoutOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subMonthWithoutOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addMonthsWithNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addMonthWithNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subMonthsWithNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subMonthWithNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addMonthsNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addMonthNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subMonthsNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subMonthNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addDays(int $value = 1) Add days (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addDay() Add one day to the instance (using date interval). - * @method CarbonImmutable subDays(int $value = 1) Sub days (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subDay() Sub one day to the instance (using date interval). - * @method CarbonImmutable addHours(int $value = 1) Add hours (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addHour() Add one hour to the instance (using date interval). - * @method CarbonImmutable subHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subHour() Sub one hour to the instance (using date interval). - * @method CarbonImmutable addMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addMinute() Add one minute to the instance (using date interval). - * @method CarbonImmutable subMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subMinute() Sub one minute to the instance (using date interval). - * @method CarbonImmutable addSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addSecond() Add one second to the instance (using date interval). - * @method CarbonImmutable subSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subSecond() Sub one second to the instance (using date interval). - * @method CarbonImmutable addMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addMilli() Add one millisecond to the instance (using date interval). - * @method CarbonImmutable subMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subMilli() Sub one millisecond to the instance (using date interval). - * @method CarbonImmutable addMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addMillisecond() Add one millisecond to the instance (using date interval). - * @method CarbonImmutable subMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subMillisecond() Sub one millisecond to the instance (using date interval). - * @method CarbonImmutable addMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addMicro() Add one microsecond to the instance (using date interval). - * @method CarbonImmutable subMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subMicro() Sub one microsecond to the instance (using date interval). - * @method CarbonImmutable addMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addMicrosecond() Add one microsecond to the instance (using date interval). - * @method CarbonImmutable subMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subMicrosecond() Sub one microsecond to the instance (using date interval). - * @method CarbonImmutable addMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addMillennium() Add one millennium to the instance (using date interval). - * @method CarbonImmutable subMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subMillennium() Sub one millennium to the instance (using date interval). - * @method CarbonImmutable addMillenniaWithOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable addMillenniumWithOverflow() Add one millennium to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable subMillenniaWithOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable subMillenniumWithOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable addMillenniaWithoutOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addMillenniumWithoutOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subMillenniaWithoutOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subMillenniumWithoutOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addMillenniaWithNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addMillenniumWithNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subMillenniaWithNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subMillenniumWithNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addMillenniaNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addMillenniumNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subMillenniaNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subMillenniumNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addCentury() Add one century to the instance (using date interval). - * @method CarbonImmutable subCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subCentury() Sub one century to the instance (using date interval). - * @method CarbonImmutable addCenturiesWithOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable addCenturyWithOverflow() Add one century to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable subCenturiesWithOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable subCenturyWithOverflow() Sub one century to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable addCenturiesWithoutOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addCenturyWithoutOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subCenturiesWithoutOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subCenturyWithoutOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addCenturiesWithNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addCenturyWithNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subCenturiesWithNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subCenturyWithNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addCenturiesNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addCenturyNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subCenturiesNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subCenturyNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addDecade() Add one decade to the instance (using date interval). - * @method CarbonImmutable subDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subDecade() Sub one decade to the instance (using date interval). - * @method CarbonImmutable addDecadesWithOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable addDecadeWithOverflow() Add one decade to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable subDecadesWithOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable subDecadeWithOverflow() Sub one decade to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable addDecadesWithoutOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addDecadeWithoutOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subDecadesWithoutOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subDecadeWithoutOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addDecadesWithNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addDecadeWithNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subDecadesWithNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subDecadeWithNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addDecadesNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addDecadeNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subDecadesNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subDecadeNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addQuarter() Add one quarter to the instance (using date interval). - * @method CarbonImmutable subQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subQuarter() Sub one quarter to the instance (using date interval). - * @method CarbonImmutable addQuartersWithOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable addQuarterWithOverflow() Add one quarter to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable subQuartersWithOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable subQuarterWithOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly allowed. - * @method CarbonImmutable addQuartersWithoutOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addQuarterWithoutOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subQuartersWithoutOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subQuarterWithoutOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addQuartersWithNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addQuarterWithNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subQuartersWithNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subQuarterWithNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addQuartersNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addQuarterNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subQuartersNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable subQuarterNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. - * @method CarbonImmutable addWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addWeek() Add one week to the instance (using date interval). - * @method CarbonImmutable subWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subWeek() Sub one week to the instance (using date interval). - * @method CarbonImmutable addWeekdays(int $value = 1) Add weekdays (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable addWeekday() Add one weekday to the instance (using date interval). - * @method CarbonImmutable subWeekdays(int $value = 1) Sub weekdays (the $value count passed in) to the instance (using date interval). - * @method CarbonImmutable subWeekday() Sub one weekday to the instance (using date interval). - * @method CarbonImmutable addRealMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealMicro() Add one microsecond to the instance (using timestamp). - * @method CarbonImmutable subRealMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable subRealMicro() Sub one microsecond to the instance (using timestamp). - * @method CarbonPeriod microsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given. - * @method CarbonImmutable addRealMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealMicrosecond() Add one microsecond to the instance (using timestamp). - * @method CarbonImmutable subRealMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable subRealMicrosecond() Sub one microsecond to the instance (using timestamp). - * @method CarbonPeriod microsecondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given. - * @method CarbonImmutable addRealMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealMilli() Add one millisecond to the instance (using timestamp). - * @method CarbonImmutable subRealMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable subRealMilli() Sub one millisecond to the instance (using timestamp). - * @method CarbonPeriod millisUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given. - * @method CarbonImmutable addRealMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealMillisecond() Add one millisecond to the instance (using timestamp). - * @method CarbonImmutable subRealMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable subRealMillisecond() Sub one millisecond to the instance (using timestamp). - * @method CarbonPeriod millisecondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given. - * @method CarbonImmutable addRealSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealSecond() Add one second to the instance (using timestamp). - * @method CarbonImmutable subRealSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable subRealSecond() Sub one second to the instance (using timestamp). - * @method CarbonPeriod secondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each second or every X seconds if a factor is given. - * @method CarbonImmutable addRealMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealMinute() Add one minute to the instance (using timestamp). - * @method CarbonImmutable subRealMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable subRealMinute() Sub one minute to the instance (using timestamp). - * @method CarbonPeriod minutesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each minute or every X minutes if a factor is given. - * @method CarbonImmutable addRealHours(int $value = 1) Add hours (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealHour() Add one hour to the instance (using timestamp). - * @method CarbonImmutable subRealHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable subRealHour() Sub one hour to the instance (using timestamp). - * @method CarbonPeriod hoursUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each hour or every X hours if a factor is given. - * @method CarbonImmutable addRealDays(int $value = 1) Add days (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealDay() Add one day to the instance (using timestamp). - * @method CarbonImmutable subRealDays(int $value = 1) Sub days (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable subRealDay() Sub one day to the instance (using timestamp). - * @method CarbonPeriod daysUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each day or every X days if a factor is given. - * @method CarbonImmutable addRealWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealWeek() Add one week to the instance (using timestamp). - * @method CarbonImmutable subRealWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable subRealWeek() Sub one week to the instance (using timestamp). - * @method CarbonPeriod weeksUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each week or every X weeks if a factor is given. - * @method CarbonImmutable addRealMonths(int $value = 1) Add months (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealMonth() Add one month to the instance (using timestamp). - * @method CarbonImmutable subRealMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable subRealMonth() Sub one month to the instance (using timestamp). - * @method CarbonPeriod monthsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each month or every X months if a factor is given. - * @method CarbonImmutable addRealQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealQuarter() Add one quarter to the instance (using timestamp). - * @method CarbonImmutable subRealQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable subRealQuarter() Sub one quarter to the instance (using timestamp). - * @method CarbonPeriod quartersUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each quarter or every X quarters if a factor is given. - * @method CarbonImmutable addRealYears(int $value = 1) Add years (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealYear() Add one year to the instance (using timestamp). - * @method CarbonImmutable subRealYears(int $value = 1) Sub years (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable subRealYear() Sub one year to the instance (using timestamp). - * @method CarbonPeriod yearsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each year or every X years if a factor is given. - * @method CarbonImmutable addRealDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealDecade() Add one decade to the instance (using timestamp). - * @method CarbonImmutable subRealDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable subRealDecade() Sub one decade to the instance (using timestamp). - * @method CarbonPeriod decadesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each decade or every X decades if a factor is given. - * @method CarbonImmutable addRealCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealCentury() Add one century to the instance (using timestamp). - * @method CarbonImmutable subRealCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable subRealCentury() Sub one century to the instance (using timestamp). - * @method CarbonPeriod centuriesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each century or every X centuries if a factor is given. - * @method CarbonImmutable addRealMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable addRealMillennium() Add one millennium to the instance (using timestamp). - * @method CarbonImmutable subRealMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using timestamp). - * @method CarbonImmutable subRealMillennium() Sub one millennium to the instance (using timestamp). - * @method CarbonPeriod millenniaUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millennium or every X millennia if a factor is given. - * @method CarbonImmutable roundYear(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. - * @method CarbonImmutable roundYears(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. - * @method CarbonImmutable floorYear(float $precision = 1) Truncate the current instance year with given precision. - * @method CarbonImmutable floorYears(float $precision = 1) Truncate the current instance year with given precision. - * @method CarbonImmutable ceilYear(float $precision = 1) Ceil the current instance year with given precision. - * @method CarbonImmutable ceilYears(float $precision = 1) Ceil the current instance year with given precision. - * @method CarbonImmutable roundMonth(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. - * @method CarbonImmutable roundMonths(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. - * @method CarbonImmutable floorMonth(float $precision = 1) Truncate the current instance month with given precision. - * @method CarbonImmutable floorMonths(float $precision = 1) Truncate the current instance month with given precision. - * @method CarbonImmutable ceilMonth(float $precision = 1) Ceil the current instance month with given precision. - * @method CarbonImmutable ceilMonths(float $precision = 1) Ceil the current instance month with given precision. - * @method CarbonImmutable roundDay(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. - * @method CarbonImmutable roundDays(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. - * @method CarbonImmutable floorDay(float $precision = 1) Truncate the current instance day with given precision. - * @method CarbonImmutable floorDays(float $precision = 1) Truncate the current instance day with given precision. - * @method CarbonImmutable ceilDay(float $precision = 1) Ceil the current instance day with given precision. - * @method CarbonImmutable ceilDays(float $precision = 1) Ceil the current instance day with given precision. - * @method CarbonImmutable roundHour(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. - * @method CarbonImmutable roundHours(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. - * @method CarbonImmutable floorHour(float $precision = 1) Truncate the current instance hour with given precision. - * @method CarbonImmutable floorHours(float $precision = 1) Truncate the current instance hour with given precision. - * @method CarbonImmutable ceilHour(float $precision = 1) Ceil the current instance hour with given precision. - * @method CarbonImmutable ceilHours(float $precision = 1) Ceil the current instance hour with given precision. - * @method CarbonImmutable roundMinute(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. - * @method CarbonImmutable roundMinutes(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. - * @method CarbonImmutable floorMinute(float $precision = 1) Truncate the current instance minute with given precision. - * @method CarbonImmutable floorMinutes(float $precision = 1) Truncate the current instance minute with given precision. - * @method CarbonImmutable ceilMinute(float $precision = 1) Ceil the current instance minute with given precision. - * @method CarbonImmutable ceilMinutes(float $precision = 1) Ceil the current instance minute with given precision. - * @method CarbonImmutable roundSecond(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. - * @method CarbonImmutable roundSeconds(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. - * @method CarbonImmutable floorSecond(float $precision = 1) Truncate the current instance second with given precision. - * @method CarbonImmutable floorSeconds(float $precision = 1) Truncate the current instance second with given precision. - * @method CarbonImmutable ceilSecond(float $precision = 1) Ceil the current instance second with given precision. - * @method CarbonImmutable ceilSeconds(float $precision = 1) Ceil the current instance second with given precision. - * @method CarbonImmutable roundMillennium(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. - * @method CarbonImmutable roundMillennia(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. - * @method CarbonImmutable floorMillennium(float $precision = 1) Truncate the current instance millennium with given precision. - * @method CarbonImmutable floorMillennia(float $precision = 1) Truncate the current instance millennium with given precision. - * @method CarbonImmutable ceilMillennium(float $precision = 1) Ceil the current instance millennium with given precision. - * @method CarbonImmutable ceilMillennia(float $precision = 1) Ceil the current instance millennium with given precision. - * @method CarbonImmutable roundCentury(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. - * @method CarbonImmutable roundCenturies(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. - * @method CarbonImmutable floorCentury(float $precision = 1) Truncate the current instance century with given precision. - * @method CarbonImmutable floorCenturies(float $precision = 1) Truncate the current instance century with given precision. - * @method CarbonImmutable ceilCentury(float $precision = 1) Ceil the current instance century with given precision. - * @method CarbonImmutable ceilCenturies(float $precision = 1) Ceil the current instance century with given precision. - * @method CarbonImmutable roundDecade(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. - * @method CarbonImmutable roundDecades(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. - * @method CarbonImmutable floorDecade(float $precision = 1) Truncate the current instance decade with given precision. - * @method CarbonImmutable floorDecades(float $precision = 1) Truncate the current instance decade with given precision. - * @method CarbonImmutable ceilDecade(float $precision = 1) Ceil the current instance decade with given precision. - * @method CarbonImmutable ceilDecades(float $precision = 1) Ceil the current instance decade with given precision. - * @method CarbonImmutable roundQuarter(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. - * @method CarbonImmutable roundQuarters(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. - * @method CarbonImmutable floorQuarter(float $precision = 1) Truncate the current instance quarter with given precision. - * @method CarbonImmutable floorQuarters(float $precision = 1) Truncate the current instance quarter with given precision. - * @method CarbonImmutable ceilQuarter(float $precision = 1) Ceil the current instance quarter with given precision. - * @method CarbonImmutable ceilQuarters(float $precision = 1) Ceil the current instance quarter with given precision. - * @method CarbonImmutable roundMillisecond(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. - * @method CarbonImmutable roundMilliseconds(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. - * @method CarbonImmutable floorMillisecond(float $precision = 1) Truncate the current instance millisecond with given precision. - * @method CarbonImmutable floorMilliseconds(float $precision = 1) Truncate the current instance millisecond with given precision. - * @method CarbonImmutable ceilMillisecond(float $precision = 1) Ceil the current instance millisecond with given precision. - * @method CarbonImmutable ceilMilliseconds(float $precision = 1) Ceil the current instance millisecond with given precision. - * @method CarbonImmutable roundMicrosecond(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. - * @method CarbonImmutable roundMicroseconds(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. - * @method CarbonImmutable floorMicrosecond(float $precision = 1) Truncate the current instance microsecond with given precision. - * @method CarbonImmutable floorMicroseconds(float $precision = 1) Truncate the current instance microsecond with given precision. - * @method CarbonImmutable ceilMicrosecond(float $precision = 1) Ceil the current instance microsecond with given precision. - * @method CarbonImmutable ceilMicroseconds(float $precision = 1) Ceil the current instance microsecond with given precision. - * @method string shortAbsoluteDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'Absolute' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) - * @method string longAbsoluteDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'Absolute' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) - * @method string shortRelativeDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'Relative' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) - * @method string longRelativeDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'Relative' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) - * @method string shortRelativeToNowDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) - * @method string longRelativeToNowDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) - * @method string shortRelativeToOtherDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) - * @method string longRelativeToOtherDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) - * @method static CarbonImmutable|false createFromFormat(string $format, string $time, string|DateTimeZone $timezone = null) Parse a string into a new CarbonImmutable object according to the specified format. - * @method static CarbonImmutable __set_state(array $array) https://php.net/manual/en/datetime.set-state.php + * @method bool isUtc() Check if the current instance has UTC timezone. (Both isUtc and isUTC cases are valid.) + * @method bool isLocal() Check if the current instance has non-UTC timezone. + * @method bool isValid() Check if the current instance is a valid date. + * @method bool isDST() Check if the current instance is in a daylight saving time. + * @method bool isSunday() Checks if the instance day is sunday. + * @method bool isMonday() Checks if the instance day is monday. + * @method bool isTuesday() Checks if the instance day is tuesday. + * @method bool isWednesday() Checks if the instance day is wednesday. + * @method bool isThursday() Checks if the instance day is thursday. + * @method bool isFriday() Checks if the instance day is friday. + * @method bool isSaturday() Checks if the instance day is saturday. + * @method bool isSameYear(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same year as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentYear() Checks if the instance is in the same year as the current moment. + * @method bool isNextYear() Checks if the instance is in the same year as the current moment next year. + * @method bool isLastYear() Checks if the instance is in the same year as the current moment last year. + * @method bool isSameWeek(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same week as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentWeek() Checks if the instance is in the same week as the current moment. + * @method bool isNextWeek() Checks if the instance is in the same week as the current moment next week. + * @method bool isLastWeek() Checks if the instance is in the same week as the current moment last week. + * @method bool isSameDay(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same day as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentDay() Checks if the instance is in the same day as the current moment. + * @method bool isNextDay() Checks if the instance is in the same day as the current moment next day. + * @method bool isLastDay() Checks if the instance is in the same day as the current moment last day. + * @method bool isSameHour(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same hour as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentHour() Checks if the instance is in the same hour as the current moment. + * @method bool isNextHour() Checks if the instance is in the same hour as the current moment next hour. + * @method bool isLastHour() Checks if the instance is in the same hour as the current moment last hour. + * @method bool isSameMinute(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same minute as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMinute() Checks if the instance is in the same minute as the current moment. + * @method bool isNextMinute() Checks if the instance is in the same minute as the current moment next minute. + * @method bool isLastMinute() Checks if the instance is in the same minute as the current moment last minute. + * @method bool isSameSecond(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same second as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentSecond() Checks if the instance is in the same second as the current moment. + * @method bool isNextSecond() Checks if the instance is in the same second as the current moment next second. + * @method bool isLastSecond() Checks if the instance is in the same second as the current moment last second. + * @method bool isSameMicro(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMicro() Checks if the instance is in the same microsecond as the current moment. + * @method bool isNextMicro() Checks if the instance is in the same microsecond as the current moment next microsecond. + * @method bool isLastMicro() Checks if the instance is in the same microsecond as the current moment last microsecond. + * @method bool isSameMicrosecond(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same microsecond as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMicrosecond() Checks if the instance is in the same microsecond as the current moment. + * @method bool isNextMicrosecond() Checks if the instance is in the same microsecond as the current moment next microsecond. + * @method bool isLastMicrosecond() Checks if the instance is in the same microsecond as the current moment last microsecond. + * @method bool isCurrentMonth() Checks if the instance is in the same month as the current moment. + * @method bool isNextMonth() Checks if the instance is in the same month as the current moment next month. + * @method bool isLastMonth() Checks if the instance is in the same month as the current moment last month. + * @method bool isCurrentQuarter() Checks if the instance is in the same quarter as the current moment. + * @method bool isNextQuarter() Checks if the instance is in the same quarter as the current moment next quarter. + * @method bool isLastQuarter() Checks if the instance is in the same quarter as the current moment last quarter. + * @method bool isSameDecade(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same decade as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentDecade() Checks if the instance is in the same decade as the current moment. + * @method bool isNextDecade() Checks if the instance is in the same decade as the current moment next decade. + * @method bool isLastDecade() Checks if the instance is in the same decade as the current moment last decade. + * @method bool isSameCentury(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same century as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentCentury() Checks if the instance is in the same century as the current moment. + * @method bool isNextCentury() Checks if the instance is in the same century as the current moment next century. + * @method bool isLastCentury() Checks if the instance is in the same century as the current moment last century. + * @method bool isSameMillennium(Carbon|DateTimeInterface|string|null $date = null) Checks if the given date is in the same millennium as the instance. If null passed, compare to now (with the same timezone). + * @method bool isCurrentMillennium() Checks if the instance is in the same millennium as the current moment. + * @method bool isNextMillennium() Checks if the instance is in the same millennium as the current moment next millennium. + * @method bool isLastMillennium() Checks if the instance is in the same millennium as the current moment last millennium. + * @method CarbonImmutable years(int $value) Set current instance year to the given value. + * @method CarbonImmutable year(int $value) Set current instance year to the given value. + * @method CarbonImmutable setYears(int $value) Set current instance year to the given value. + * @method CarbonImmutable setYear(int $value) Set current instance year to the given value. + * @method CarbonImmutable months(int $value) Set current instance month to the given value. + * @method CarbonImmutable month(int $value) Set current instance month to the given value. + * @method CarbonImmutable setMonths(int $value) Set current instance month to the given value. + * @method CarbonImmutable setMonth(int $value) Set current instance month to the given value. + * @method CarbonImmutable days(int $value) Set current instance day to the given value. + * @method CarbonImmutable day(int $value) Set current instance day to the given value. + * @method CarbonImmutable setDays(int $value) Set current instance day to the given value. + * @method CarbonImmutable setDay(int $value) Set current instance day to the given value. + * @method CarbonImmutable hours(int $value) Set current instance hour to the given value. + * @method CarbonImmutable hour(int $value) Set current instance hour to the given value. + * @method CarbonImmutable setHours(int $value) Set current instance hour to the given value. + * @method CarbonImmutable setHour(int $value) Set current instance hour to the given value. + * @method CarbonImmutable minutes(int $value) Set current instance minute to the given value. + * @method CarbonImmutable minute(int $value) Set current instance minute to the given value. + * @method CarbonImmutable setMinutes(int $value) Set current instance minute to the given value. + * @method CarbonImmutable setMinute(int $value) Set current instance minute to the given value. + * @method CarbonImmutable seconds(int $value) Set current instance second to the given value. + * @method CarbonImmutable second(int $value) Set current instance second to the given value. + * @method CarbonImmutable setSeconds(int $value) Set current instance second to the given value. + * @method CarbonImmutable setSecond(int $value) Set current instance second to the given value. + * @method CarbonImmutable millis(int $value) Set current instance millisecond to the given value. + * @method CarbonImmutable milli(int $value) Set current instance millisecond to the given value. + * @method CarbonImmutable setMillis(int $value) Set current instance millisecond to the given value. + * @method CarbonImmutable setMilli(int $value) Set current instance millisecond to the given value. + * @method CarbonImmutable milliseconds(int $value) Set current instance millisecond to the given value. + * @method CarbonImmutable millisecond(int $value) Set current instance millisecond to the given value. + * @method CarbonImmutable setMilliseconds(int $value) Set current instance millisecond to the given value. + * @method CarbonImmutable setMillisecond(int $value) Set current instance millisecond to the given value. + * @method CarbonImmutable micros(int $value) Set current instance microsecond to the given value. + * @method CarbonImmutable micro(int $value) Set current instance microsecond to the given value. + * @method CarbonImmutable setMicros(int $value) Set current instance microsecond to the given value. + * @method CarbonImmutable setMicro(int $value) Set current instance microsecond to the given value. + * @method CarbonImmutable microseconds(int $value) Set current instance microsecond to the given value. + * @method CarbonImmutable microsecond(int $value) Set current instance microsecond to the given value. + * @method CarbonImmutable setMicroseconds(int $value) Set current instance microsecond to the given value. + * @method CarbonImmutable setMicrosecond(int $value) Set current instance microsecond to the given value. + * @method CarbonImmutable addYears(int $value = 1) Add years (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addYear() Add one year to the instance (using date interval). + * @method CarbonImmutable subYears(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subYear() Sub one year to the instance (using date interval). + * @method CarbonImmutable addYearsWithOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addYearWithOverflow() Add one year to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subYearsWithOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subYearWithOverflow() Sub one year to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addYearsWithoutOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addYearWithoutOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subYearsWithoutOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subYearWithoutOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addYearsWithNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addYearWithNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subYearsWithNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subYearWithNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addYearsNoOverflow(int $value = 1) Add years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addYearNoOverflow() Add one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subYearsNoOverflow(int $value = 1) Sub years (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subYearNoOverflow() Sub one year to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMonths(int $value = 1) Add months (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addMonth() Add one month to the instance (using date interval). + * @method CarbonImmutable subMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subMonth() Sub one month to the instance (using date interval). + * @method CarbonImmutable addMonthsWithOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addMonthWithOverflow() Add one month to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subMonthsWithOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subMonthWithOverflow() Sub one month to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addMonthsWithoutOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMonthWithoutOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMonthsWithoutOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMonthWithoutOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMonthsWithNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMonthWithNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMonthsWithNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMonthWithNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMonthsNoOverflow(int $value = 1) Add months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMonthNoOverflow() Add one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMonthsNoOverflow(int $value = 1) Sub months (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMonthNoOverflow() Sub one month to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addDays(int $value = 1) Add days (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addDay() Add one day to the instance (using date interval). + * @method CarbonImmutable subDays(int $value = 1) Sub days (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subDay() Sub one day to the instance (using date interval). + * @method CarbonImmutable addHours(int $value = 1) Add hours (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addHour() Add one hour to the instance (using date interval). + * @method CarbonImmutable subHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subHour() Sub one hour to the instance (using date interval). + * @method CarbonImmutable addMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addMinute() Add one minute to the instance (using date interval). + * @method CarbonImmutable subMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subMinute() Sub one minute to the instance (using date interval). + * @method CarbonImmutable addSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addSecond() Add one second to the instance (using date interval). + * @method CarbonImmutable subSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subSecond() Sub one second to the instance (using date interval). + * @method CarbonImmutable addMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addMilli() Add one millisecond to the instance (using date interval). + * @method CarbonImmutable subMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subMilli() Sub one millisecond to the instance (using date interval). + * @method CarbonImmutable addMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addMillisecond() Add one millisecond to the instance (using date interval). + * @method CarbonImmutable subMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subMillisecond() Sub one millisecond to the instance (using date interval). + * @method CarbonImmutable addMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addMicro() Add one microsecond to the instance (using date interval). + * @method CarbonImmutable subMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subMicro() Sub one microsecond to the instance (using date interval). + * @method CarbonImmutable addMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addMicrosecond() Add one microsecond to the instance (using date interval). + * @method CarbonImmutable subMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subMicrosecond() Sub one microsecond to the instance (using date interval). + * @method CarbonImmutable addMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addMillennium() Add one millennium to the instance (using date interval). + * @method CarbonImmutable subMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subMillennium() Sub one millennium to the instance (using date interval). + * @method CarbonImmutable addMillenniaWithOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addMillenniumWithOverflow() Add one millennium to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subMillenniaWithOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subMillenniumWithOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addMillenniaWithoutOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMillenniumWithoutOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMillenniaWithoutOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMillenniumWithoutOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMillenniaWithNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMillenniumWithNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMillenniaWithNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMillenniumWithNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMillenniaNoOverflow(int $value = 1) Add millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addMillenniumNoOverflow() Add one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMillenniaNoOverflow(int $value = 1) Sub millennia (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subMillenniumNoOverflow() Sub one millennium to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addCentury() Add one century to the instance (using date interval). + * @method CarbonImmutable subCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subCentury() Sub one century to the instance (using date interval). + * @method CarbonImmutable addCenturiesWithOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addCenturyWithOverflow() Add one century to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subCenturiesWithOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subCenturyWithOverflow() Sub one century to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addCenturiesWithoutOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addCenturyWithoutOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subCenturiesWithoutOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subCenturyWithoutOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addCenturiesWithNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addCenturyWithNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subCenturiesWithNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subCenturyWithNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addCenturiesNoOverflow(int $value = 1) Add centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addCenturyNoOverflow() Add one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subCenturiesNoOverflow(int $value = 1) Sub centuries (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subCenturyNoOverflow() Sub one century to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addDecade() Add one decade to the instance (using date interval). + * @method CarbonImmutable subDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subDecade() Sub one decade to the instance (using date interval). + * @method CarbonImmutable addDecadesWithOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addDecadeWithOverflow() Add one decade to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subDecadesWithOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subDecadeWithOverflow() Sub one decade to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addDecadesWithoutOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addDecadeWithoutOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subDecadesWithoutOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subDecadeWithoutOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addDecadesWithNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addDecadeWithNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subDecadesWithNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subDecadeWithNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addDecadesNoOverflow(int $value = 1) Add decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addDecadeNoOverflow() Add one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subDecadesNoOverflow(int $value = 1) Sub decades (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subDecadeNoOverflow() Sub one decade to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addQuarter() Add one quarter to the instance (using date interval). + * @method CarbonImmutable subQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subQuarter() Sub one quarter to the instance (using date interval). + * @method CarbonImmutable addQuartersWithOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addQuarterWithOverflow() Add one quarter to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subQuartersWithOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable subQuarterWithOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly allowed. + * @method CarbonImmutable addQuartersWithoutOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addQuarterWithoutOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subQuartersWithoutOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subQuarterWithoutOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addQuartersWithNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addQuarterWithNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subQuartersWithNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subQuarterWithNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addQuartersNoOverflow(int $value = 1) Add quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addQuarterNoOverflow() Add one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subQuartersNoOverflow(int $value = 1) Sub quarters (the $value count passed in) to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable subQuarterNoOverflow() Sub one quarter to the instance (using date interval) with overflow explicitly forbidden. + * @method CarbonImmutable addWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addWeek() Add one week to the instance (using date interval). + * @method CarbonImmutable subWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subWeek() Sub one week to the instance (using date interval). + * @method CarbonImmutable addWeekdays(int $value = 1) Add weekdays (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable addWeekday() Add one weekday to the instance (using date interval). + * @method CarbonImmutable subWeekdays(int $value = 1) Sub weekdays (the $value count passed in) to the instance (using date interval). + * @method CarbonImmutable subWeekday() Sub one weekday to the instance (using date interval). + * @method CarbonImmutable addRealMicros(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealMicro() Add one microsecond to the instance (using timestamp). + * @method CarbonImmutable subRealMicros(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealMicro() Sub one microsecond to the instance (using timestamp). + * @method CarbonPeriod microsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given. + * @method CarbonImmutable addRealMicroseconds(int $value = 1) Add microseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealMicrosecond() Add one microsecond to the instance (using timestamp). + * @method CarbonImmutable subRealMicroseconds(int $value = 1) Sub microseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealMicrosecond() Sub one microsecond to the instance (using timestamp). + * @method CarbonPeriod microsecondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each microsecond or every X microseconds if a factor is given. + * @method CarbonImmutable addRealMillis(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealMilli() Add one millisecond to the instance (using timestamp). + * @method CarbonImmutable subRealMillis(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealMilli() Sub one millisecond to the instance (using timestamp). + * @method CarbonPeriod millisUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given. + * @method CarbonImmutable addRealMilliseconds(int $value = 1) Add milliseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealMillisecond() Add one millisecond to the instance (using timestamp). + * @method CarbonImmutable subRealMilliseconds(int $value = 1) Sub milliseconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealMillisecond() Sub one millisecond to the instance (using timestamp). + * @method CarbonPeriod millisecondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millisecond or every X milliseconds if a factor is given. + * @method CarbonImmutable addRealSeconds(int $value = 1) Add seconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealSecond() Add one second to the instance (using timestamp). + * @method CarbonImmutable subRealSeconds(int $value = 1) Sub seconds (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealSecond() Sub one second to the instance (using timestamp). + * @method CarbonPeriod secondsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each second or every X seconds if a factor is given. + * @method CarbonImmutable addRealMinutes(int $value = 1) Add minutes (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealMinute() Add one minute to the instance (using timestamp). + * @method CarbonImmutable subRealMinutes(int $value = 1) Sub minutes (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealMinute() Sub one minute to the instance (using timestamp). + * @method CarbonPeriod minutesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each minute or every X minutes if a factor is given. + * @method CarbonImmutable addRealHours(int $value = 1) Add hours (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealHour() Add one hour to the instance (using timestamp). + * @method CarbonImmutable subRealHours(int $value = 1) Sub hours (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealHour() Sub one hour to the instance (using timestamp). + * @method CarbonPeriod hoursUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each hour or every X hours if a factor is given. + * @method CarbonImmutable addRealDays(int $value = 1) Add days (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealDay() Add one day to the instance (using timestamp). + * @method CarbonImmutable subRealDays(int $value = 1) Sub days (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealDay() Sub one day to the instance (using timestamp). + * @method CarbonPeriod daysUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each day or every X days if a factor is given. + * @method CarbonImmutable addRealWeeks(int $value = 1) Add weeks (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealWeek() Add one week to the instance (using timestamp). + * @method CarbonImmutable subRealWeeks(int $value = 1) Sub weeks (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealWeek() Sub one week to the instance (using timestamp). + * @method CarbonPeriod weeksUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each week or every X weeks if a factor is given. + * @method CarbonImmutable addRealMonths(int $value = 1) Add months (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealMonth() Add one month to the instance (using timestamp). + * @method CarbonImmutable subRealMonths(int $value = 1) Sub months (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealMonth() Sub one month to the instance (using timestamp). + * @method CarbonPeriod monthsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each month or every X months if a factor is given. + * @method CarbonImmutable addRealQuarters(int $value = 1) Add quarters (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealQuarter() Add one quarter to the instance (using timestamp). + * @method CarbonImmutable subRealQuarters(int $value = 1) Sub quarters (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealQuarter() Sub one quarter to the instance (using timestamp). + * @method CarbonPeriod quartersUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each quarter or every X quarters if a factor is given. + * @method CarbonImmutable addRealYears(int $value = 1) Add years (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealYear() Add one year to the instance (using timestamp). + * @method CarbonImmutable subRealYears(int $value = 1) Sub years (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealYear() Sub one year to the instance (using timestamp). + * @method CarbonPeriod yearsUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each year or every X years if a factor is given. + * @method CarbonImmutable addRealDecades(int $value = 1) Add decades (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealDecade() Add one decade to the instance (using timestamp). + * @method CarbonImmutable subRealDecades(int $value = 1) Sub decades (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealDecade() Sub one decade to the instance (using timestamp). + * @method CarbonPeriod decadesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each decade or every X decades if a factor is given. + * @method CarbonImmutable addRealCenturies(int $value = 1) Add centuries (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealCentury() Add one century to the instance (using timestamp). + * @method CarbonImmutable subRealCenturies(int $value = 1) Sub centuries (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealCentury() Sub one century to the instance (using timestamp). + * @method CarbonPeriod centuriesUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each century or every X centuries if a factor is given. + * @method CarbonImmutable addRealMillennia(int $value = 1) Add millennia (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable addRealMillennium() Add one millennium to the instance (using timestamp). + * @method CarbonImmutable subRealMillennia(int $value = 1) Sub millennia (the $value count passed in) to the instance (using timestamp). + * @method CarbonImmutable subRealMillennium() Sub one millennium to the instance (using timestamp). + * @method CarbonPeriod millenniaUntil($endDate = null, int $factor = 1) Return an iterable period from current date to given end (string, DateTime or Carbon instance) for each millennium or every X millennia if a factor is given. + * @method CarbonImmutable roundYear(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. + * @method CarbonImmutable roundYears(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. + * @method CarbonImmutable floorYear(float $precision = 1) Truncate the current instance year with given precision. + * @method CarbonImmutable floorYears(float $precision = 1) Truncate the current instance year with given precision. + * @method CarbonImmutable ceilYear(float $precision = 1) Ceil the current instance year with given precision. + * @method CarbonImmutable ceilYears(float $precision = 1) Ceil the current instance year with given precision. + * @method CarbonImmutable roundMonth(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. + * @method CarbonImmutable roundMonths(float $precision = 1, string $function = "round") Round the current instance month with given precision using the given function. + * @method CarbonImmutable floorMonth(float $precision = 1) Truncate the current instance month with given precision. + * @method CarbonImmutable floorMonths(float $precision = 1) Truncate the current instance month with given precision. + * @method CarbonImmutable ceilMonth(float $precision = 1) Ceil the current instance month with given precision. + * @method CarbonImmutable ceilMonths(float $precision = 1) Ceil the current instance month with given precision. + * @method CarbonImmutable roundDay(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method CarbonImmutable roundDays(float $precision = 1, string $function = "round") Round the current instance day with given precision using the given function. + * @method CarbonImmutable floorDay(float $precision = 1) Truncate the current instance day with given precision. + * @method CarbonImmutable floorDays(float $precision = 1) Truncate the current instance day with given precision. + * @method CarbonImmutable ceilDay(float $precision = 1) Ceil the current instance day with given precision. + * @method CarbonImmutable ceilDays(float $precision = 1) Ceil the current instance day with given precision. + * @method CarbonImmutable roundHour(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. + * @method CarbonImmutable roundHours(float $precision = 1, string $function = "round") Round the current instance hour with given precision using the given function. + * @method CarbonImmutable floorHour(float $precision = 1) Truncate the current instance hour with given precision. + * @method CarbonImmutable floorHours(float $precision = 1) Truncate the current instance hour with given precision. + * @method CarbonImmutable ceilHour(float $precision = 1) Ceil the current instance hour with given precision. + * @method CarbonImmutable ceilHours(float $precision = 1) Ceil the current instance hour with given precision. + * @method CarbonImmutable roundMinute(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. + * @method CarbonImmutable roundMinutes(float $precision = 1, string $function = "round") Round the current instance minute with given precision using the given function. + * @method CarbonImmutable floorMinute(float $precision = 1) Truncate the current instance minute with given precision. + * @method CarbonImmutable floorMinutes(float $precision = 1) Truncate the current instance minute with given precision. + * @method CarbonImmutable ceilMinute(float $precision = 1) Ceil the current instance minute with given precision. + * @method CarbonImmutable ceilMinutes(float $precision = 1) Ceil the current instance minute with given precision. + * @method CarbonImmutable roundSecond(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. + * @method CarbonImmutable roundSeconds(float $precision = 1, string $function = "round") Round the current instance second with given precision using the given function. + * @method CarbonImmutable floorSecond(float $precision = 1) Truncate the current instance second with given precision. + * @method CarbonImmutable floorSeconds(float $precision = 1) Truncate the current instance second with given precision. + * @method CarbonImmutable ceilSecond(float $precision = 1) Ceil the current instance second with given precision. + * @method CarbonImmutable ceilSeconds(float $precision = 1) Ceil the current instance second with given precision. + * @method CarbonImmutable roundMillennium(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. + * @method CarbonImmutable roundMillennia(float $precision = 1, string $function = "round") Round the current instance millennium with given precision using the given function. + * @method CarbonImmutable floorMillennium(float $precision = 1) Truncate the current instance millennium with given precision. + * @method CarbonImmutable floorMillennia(float $precision = 1) Truncate the current instance millennium with given precision. + * @method CarbonImmutable ceilMillennium(float $precision = 1) Ceil the current instance millennium with given precision. + * @method CarbonImmutable ceilMillennia(float $precision = 1) Ceil the current instance millennium with given precision. + * @method CarbonImmutable roundCentury(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. + * @method CarbonImmutable roundCenturies(float $precision = 1, string $function = "round") Round the current instance century with given precision using the given function. + * @method CarbonImmutable floorCentury(float $precision = 1) Truncate the current instance century with given precision. + * @method CarbonImmutable floorCenturies(float $precision = 1) Truncate the current instance century with given precision. + * @method CarbonImmutable ceilCentury(float $precision = 1) Ceil the current instance century with given precision. + * @method CarbonImmutable ceilCenturies(float $precision = 1) Ceil the current instance century with given precision. + * @method CarbonImmutable roundDecade(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. + * @method CarbonImmutable roundDecades(float $precision = 1, string $function = "round") Round the current instance decade with given precision using the given function. + * @method CarbonImmutable floorDecade(float $precision = 1) Truncate the current instance decade with given precision. + * @method CarbonImmutable floorDecades(float $precision = 1) Truncate the current instance decade with given precision. + * @method CarbonImmutable ceilDecade(float $precision = 1) Ceil the current instance decade with given precision. + * @method CarbonImmutable ceilDecades(float $precision = 1) Ceil the current instance decade with given precision. + * @method CarbonImmutable roundQuarter(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. + * @method CarbonImmutable roundQuarters(float $precision = 1, string $function = "round") Round the current instance quarter with given precision using the given function. + * @method CarbonImmutable floorQuarter(float $precision = 1) Truncate the current instance quarter with given precision. + * @method CarbonImmutable floorQuarters(float $precision = 1) Truncate the current instance quarter with given precision. + * @method CarbonImmutable ceilQuarter(float $precision = 1) Ceil the current instance quarter with given precision. + * @method CarbonImmutable ceilQuarters(float $precision = 1) Ceil the current instance quarter with given precision. + * @method CarbonImmutable roundMillisecond(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. + * @method CarbonImmutable roundMilliseconds(float $precision = 1, string $function = "round") Round the current instance millisecond with given precision using the given function. + * @method CarbonImmutable floorMillisecond(float $precision = 1) Truncate the current instance millisecond with given precision. + * @method CarbonImmutable floorMilliseconds(float $precision = 1) Truncate the current instance millisecond with given precision. + * @method CarbonImmutable ceilMillisecond(float $precision = 1) Ceil the current instance millisecond with given precision. + * @method CarbonImmutable ceilMilliseconds(float $precision = 1) Ceil the current instance millisecond with given precision. + * @method CarbonImmutable roundMicrosecond(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. + * @method CarbonImmutable roundMicroseconds(float $precision = 1, string $function = "round") Round the current instance microsecond with given precision using the given function. + * @method CarbonImmutable floorMicrosecond(float $precision = 1) Truncate the current instance microsecond with given precision. + * @method CarbonImmutable floorMicroseconds(float $precision = 1) Truncate the current instance microsecond with given precision. + * @method CarbonImmutable ceilMicrosecond(float $precision = 1) Ceil the current instance microsecond with given precision. + * @method CarbonImmutable ceilMicroseconds(float $precision = 1) Ceil the current instance microsecond with given precision. + * @method string shortAbsoluteDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'Absolute' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longAbsoluteDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'Absolute' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string shortRelativeDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'Relative' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longRelativeDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'Relative' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string shortRelativeToNowDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longRelativeToNowDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'RelativeToNow' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string shortRelativeToOtherDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (short format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method string longRelativeToOtherDiffForHumans(DateTimeInterface $other = null, int $parts = 1) Get the difference (long format, 'RelativeToOther' mode) in a human readable format in the current locale. ($other and $parts parameters can be swapped.) + * @method static static|false createFromFormat(string $format, string $time, DateTimeZone|string|false|null $timezone = null) Parse a string into a new CarbonImmutable object according to the specified format. + * @method static static __set_state(array $array) https://php.net/manual/en/datetime.set-state.php * * */ diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/CarbonInterface.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/CarbonInterface.php index 15e2061c7..b90e29817 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/CarbonInterface.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/CarbonInterface.php @@ -586,6 +586,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable public const YEARS_PER_DECADE = 10; public const MONTHS_PER_YEAR = 12; public const MONTHS_PER_QUARTER = 3; + public const QUARTERS_PER_YEAR = 4; public const WEEKS_PER_YEAR = 52; public const WEEKS_PER_MONTH = 4; public const DAYS_PER_YEAR = 365; @@ -726,6 +727,8 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable /** * Returns the list of properties to dump on serialize() called on. * + * Only used by PHP < 7.4. + * * @return array */ public function __sleep(); @@ -735,7 +738,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable * * @example * ``` - * echo Carbon::now(); // Carbon instances can be casted to string + * echo Carbon::now(); // Carbon instances can be cast to string * ``` * * @return string @@ -987,7 +990,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable * * @param string $modifier * - * @return static + * @return static|false */ public function change($modifier); @@ -1038,13 +1041,13 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable * If $hour is not null then the default values for $minute and $second * will be 0. * - * @param int|null $year - * @param int|null $month - * @param int|null $day - * @param int|null $hour - * @param int|null $minute - * @param int|null $second - * @param DateTimeZone|string|null $tz + * @param DateTimeInterface|int|null $year + * @param int|null $month + * @param int|null $day + * @param int|null $hour + * @param int|null $minute + * @param int|null $second + * @param DateTimeZone|string|null $tz * * @throws InvalidFormatException * @@ -1276,7 +1279,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable * * @return CarbonInterval */ - public function diffAsCarbonInterval($date = null, $absolute = true); + public function diffAsCarbonInterval($date = null, $absolute = true, array $skip = []); /** * Get the difference by the given interval using a filter closure. @@ -2116,6 +2119,18 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable */ public static function getDays(); + /** + * Return the number of days since the start of the week (using the current locale or the first parameter + * if explicitly given). + * + * @param int|null $weekStartsAt optional start allow you to specify the day of week to use to start the week, + * if not provided, start of week is inferred from the locale + * (Sunday for en_US, Monday for de_DE, etc.) + * + * @return int + */ + public function getDaysFromStartOfWeek(?int $weekStartsAt = null): int; + /** * Get the fallback locale. * @@ -2738,12 +2753,35 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable public function isLeapYear(); /** - * Determines if the instance is a long year + * Determines if the instance is a long year (using ISO 8601 year). * * @example * ``` - * Carbon::parse('2015-01-01')->isLongYear(); // true - * Carbon::parse('2016-01-01')->isLongYear(); // false + * Carbon::parse('2015-01-01')->isLongIsoYear(); // true + * Carbon::parse('2016-01-01')->isLongIsoYear(); // true + * Carbon::parse('2016-01-03')->isLongIsoYear(); // false + * Carbon::parse('2019-12-29')->isLongIsoYear(); // false + * Carbon::parse('2019-12-30')->isLongIsoYear(); // true + * ``` + * + * @see https://en.wikipedia.org/wiki/ISO_8601#Week_dates + * + * @return bool + */ + public function isLongIsoYear(); + + /** + * Determines if the instance is a long year (using calendar year). + * + * ⚠️ This method completely ignores month and day to use the numeric year number, + * it's not correct if the exact date matters. For instance as `2019-12-30` is already + * in the first week of the 2020 year, if you want to know from this date if ISO week + * year 2020 is a long year, use `isLongIsoYear` instead. + * + * @example + * ``` + * Carbon::create(2015)->isLongYear(); // true + * Carbon::create(2016)->isLongYear(); // false * ``` * * @see https://en.wikipedia.org/wiki/ISO_8601#Week_dates @@ -3382,7 +3420,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable * * @param string|int|null $modifier * - * @return static + * @return static|false */ public function next($modifier = null); @@ -3528,7 +3566,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable * * @param string|int|null $modifier * - * @return static + * @return static|false */ public function previous($modifier = null); @@ -3773,6 +3811,19 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable */ public function setDateTimeFrom($date = null); + /** + * Set the day (keeping the current time) to the start of the week + the number of days passed as the first + * parameter. First day of week is driven by the locale unless explicitly set with the second parameter. + * + * @param int $numberOfDays number of days to add after the start of the current week + * @param int|null $weekStartsAt optional start allow you to specify the day of week to use to start the week, + * if not provided, start of week is inferred from the locale + * (Sunday for en_US, Monday for de_DE, etc.) + * + * @return static + */ + public function setDaysFromStartOfWeek(int $numberOfDays, ?int $weekStartsAt = null); + /** * Set the fallback locale. * @@ -3860,7 +3911,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable * * /!\ Use this method for unit tests only. * - * @param Closure|static|string|false|null $testNow real or mock Carbon instance + * @param DateTimeInterface|Closure|static|string|false|null $testNow real or mock Carbon instance */ public static function setTestNow($testNow = null); @@ -3881,7 +3932,7 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable * * /!\ Use this method for unit tests only. * - * @param Closure|static|string|false|null $testNow real or mock Carbon instance + * @param DateTimeInterface|Closure|static|string|false|null $testNow real or mock Carbon instance */ public static function setTestNowAndTimezone($testNow = null, $tz = null); @@ -3942,11 +3993,11 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable /** * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. - * You should rather let Carbon object being casted to string with DEFAULT_TO_STRING_FORMAT, and - * use other method or custom format passed to format() method if you need to dump an other string + * You should rather let Carbon object being cast to string with DEFAULT_TO_STRING_FORMAT, and + * use other method or custom format passed to format() method if you need to dump another string * format. * - * Set the default format used when type juggling a Carbon instance to a string + * Set the default format used when type juggling a Carbon instance to a string. * * @param string|Closure|null $format * @@ -4537,6 +4588,18 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable */ public function toFormattedDateString(); + /** + * Format the instance with the day, and a readable date + * + * @example + * ``` + * echo Carbon::now()->toFormattedDayDateString(); + * ``` + * + * @return string + */ + public function toFormattedDayDateString(): string; + /** * Return the ISO-8601 string (ex: 1977-04-22T06:00:00Z, if $keepOffset truthy, offset will be kept: * 1977-04-22T01:00:00-05:00). @@ -5057,12 +5120,14 @@ interface CarbonInterface extends DateTimeInterface, JsonSerializable * * /!\ Use this method for unit tests only. * - * @param Closure|static|string|false|null $testNow real or mock Carbon instance - * @param Closure|null $callback + * @template T * - * @return mixed + * @param DateTimeInterface|Closure|static|string|false|null $testNow real or mock Carbon instance + * @param Closure(): T $callback + * + * @return T */ - public static function withTestNow($testNow = null, $callback = null); + public static function withTestNow($testNow, $callback); /** * Create a Carbon instance for yesterday. diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php index d465beac7..8437c545e 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php @@ -15,6 +15,7 @@ use Carbon\Exceptions\BadFluentConstructorException; use Carbon\Exceptions\BadFluentSetterException; use Carbon\Exceptions\InvalidCastException; use Carbon\Exceptions\InvalidIntervalException; +use Carbon\Exceptions\OutOfRangeException; use Carbon\Exceptions\ParseErrorException; use Carbon\Exceptions\UnitNotConfiguredException; use Carbon\Exceptions\UnknownGetterException; @@ -22,15 +23,20 @@ use Carbon\Exceptions\UnknownSetterException; use Carbon\Exceptions\UnknownUnitException; use Carbon\Traits\IntervalRounding; use Carbon\Traits\IntervalStep; +use Carbon\Traits\MagicParameter; use Carbon\Traits\Mixin; use Carbon\Traits\Options; +use Carbon\Traits\ToStringFormat; use Closure; use DateInterval; +use DateMalformedIntervalStringException; use DateTimeInterface; use DateTimeZone; use Exception; +use InvalidArgumentException; use ReflectionException; use ReturnTypeWillChange; +use RuntimeException; use Throwable; /** @@ -46,7 +52,7 @@ use Throwable; * @property int $minutes Total minutes of the current interval. * @property int $seconds Total seconds of the current interval. * @property int $microseconds Total microseconds of the current interval. - * @property int $milliseconds Total microseconds of the current interval. + * @property int $milliseconds Total milliseconds of the current interval. * @property int $microExcludeMilli Remaining microseconds without the milliseconds. * @property int $dayzExcludeWeeks Total days remaining in the final week of the current instance (days % 7). * @property int $daysExcludeWeeks alias of dayzExcludeWeeks @@ -184,10 +190,12 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface { use IntervalRounding; use IntervalStep; + use MagicParameter; use Mixin { Mixin::mixin as baseMixin; } use Options; + use ToStringFormat; /** * Interval spec period designators @@ -241,6 +249,11 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface */ private static $flipCascadeFactors; + /** + * @var bool + */ + private static $floatSettersEnabled = false; + /** * The registered macros. * @@ -294,7 +307,12 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface */ public static function getCascadeFactors() { - return static::$cascadeFactors ?: [ + return static::$cascadeFactors ?: static::getDefaultCascadeFactors(); + } + + protected static function getDefaultCascadeFactors(): array + { + return [ 'milliseconds' => [Carbon::MICROSECONDS_PER_MILLISECOND, 'microseconds'], 'seconds' => [Carbon::MILLISECONDS_PER_SECOND, 'milliseconds'], 'minutes' => [Carbon::SECONDS_PER_MINUTE, 'seconds'], @@ -337,6 +355,19 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface static::$cascadeFactors = $cascadeFactors; } + /** + * This option allow you to opt-in for the Carbon 3 behavior where float + * values will no longer be cast to integer (so truncated). + * + * ⚠️ This settings will be applied globally, which mean your whole application + * code including the third-party dependencies that also may use Carbon will + * adopt the new behavior. + */ + public static function enableFloatSetters(bool $floatSettersEnabled = true): void + { + self::$floatSettersEnabled = $floatSettersEnabled; + } + /////////////////////////////////////////////////////////////////// //////////////////////////// CONSTRUCTORS ///////////////////////// /////////////////////////////////////////////////////////////////// @@ -344,14 +375,14 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface /** * Create a new CarbonInterval instance. * - * @param int|null $years - * @param int|null $months - * @param int|null $weeks - * @param int|null $days - * @param int|null $hours - * @param int|null $minutes - * @param int|null $seconds - * @param int|null $microseconds + * @param Closure|DateInterval|string|int|null $years + * @param int|float|null $months + * @param int|float|null $weeks + * @param int|float|null $days + * @param int|float|null $hours + * @param int|float|null $minutes + * @param int|float|null $seconds + * @param int|float|null $microseconds * * @throws Exception when the interval_spec (passed as $years) cannot be parsed as an interval. */ @@ -371,8 +402,9 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface } $spec = $years; + $isStringSpec = (\is_string($spec) && !preg_match('/^[\d.]/', $spec)); - if (!\is_string($spec) || (float) $years || preg_match('/^[0-9.]/', $years)) { + if (!$isStringSpec || (float) $years) { $spec = static::PERIOD_PREFIX; $spec .= $years > 0 ? $years.static::PERIOD_YEARS : ''; @@ -397,7 +429,74 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface } } - parent::__construct($spec); + try { + parent::__construct($spec); + } catch (Throwable $exception) { + try { + parent::__construct('PT0S'); + + if ($isStringSpec) { + if (!preg_match('/^P + (?:(?[+-]?\d*(?:\.\d+)?)Y)? + (?:(?[+-]?\d*(?:\.\d+)?)M)? + (?:(?[+-]?\d*(?:\.\d+)?)W)? + (?:(?[+-]?\d*(?:\.\d+)?)D)? + (?:T + (?:(?[+-]?\d*(?:\.\d+)?)H)? + (?:(?[+-]?\d*(?:\.\d+)?)M)? + (?:(?[+-]?\d*(?:\.\d+)?)S)? + )? + $/x', $spec, $match)) { + throw new InvalidArgumentException("Invalid duration: $spec"); + } + + $years = (float) ($match['year'] ?? 0); + $this->assertSafeForInteger('year', $years); + $months = (float) ($match['month'] ?? 0); + $this->assertSafeForInteger('month', $months); + $weeks = (float) ($match['week'] ?? 0); + $this->assertSafeForInteger('week', $weeks); + $days = (float) ($match['day'] ?? 0); + $this->assertSafeForInteger('day', $days); + $hours = (float) ($match['hour'] ?? 0); + $this->assertSafeForInteger('hour', $hours); + $minutes = (float) ($match['minute'] ?? 0); + $this->assertSafeForInteger('minute', $minutes); + $seconds = (float) ($match['second'] ?? 0); + $this->assertSafeForInteger('second', $seconds); + } + + $totalDays = (($weeks * static::getDaysPerWeek()) + $days); + $this->assertSafeForInteger('days total (including weeks)', $totalDays); + + $this->y = (int) $years; + $this->m = (int) $months; + $this->d = (int) $totalDays; + $this->h = (int) $hours; + $this->i = (int) $minutes; + $this->s = (int) $seconds; + + if ( + ((float) $this->y) !== $years || + ((float) $this->m) !== $months || + ((float) $this->d) !== $totalDays || + ((float) $this->h) !== $hours || + ((float) $this->i) !== $minutes || + ((float) $this->s) !== $seconds + ) { + $this->add(static::fromString( + ($years - $this->y).' years '. + ($months - $this->m).' months '. + ($totalDays - $this->d).' days '. + ($hours - $this->h).' hours '. + ($minutes - $this->i).' minutes '. + ($seconds - $this->s).' seconds ' + )); + } + } catch (Throwable $secondException) { + throw $secondException instanceof OutOfRangeException ? $secondException : $exception; + } + } if ($microseconds !== null) { $this->f = $microseconds / Carbon::MICROSECONDS_PER_SECOND; @@ -410,7 +509,7 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface * @param string $source * @param string $target * - * @return int|null + * @return int|float|null */ public static function getFactor($source, $target) { @@ -438,7 +537,7 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface * @param string $source * @param string $target * - * @return int|null + * @return int|float|null */ public static function getFactorWithDefault($source, $target) { @@ -465,7 +564,7 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface /** * Returns current config for days per week. * - * @return int + * @return int|float */ public static function getDaysPerWeek() { @@ -475,7 +574,7 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface /** * Returns current config for hours per day. * - * @return int + * @return int|float */ public static function getHoursPerDay() { @@ -485,7 +584,7 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface /** * Returns current config for minutes per hour. * - * @return int + * @return int|float */ public static function getMinutesPerHour() { @@ -495,7 +594,7 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface /** * Returns current config for seconds per minute. * - * @return int + * @return int|float */ public static function getSecondsPerMinute() { @@ -505,7 +604,7 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface /** * Returns current config for microseconds per second. * - * @return int + * @return int|float */ public static function getMillisecondsPerSecond() { @@ -515,7 +614,7 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface /** * Returns current config for microseconds per second. * - * @return int + * @return int|float */ public static function getMicrosecondsPerMillisecond() { @@ -673,6 +772,23 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface } } + /** + * Evaluate the PHP generated by var_export() and recreate the exported CarbonInterval instance. + * + * @param array $dump data as exported by var_export() + * + * @return static + */ + #[ReturnTypeWillChange] + public static function __set_state($dump) + { + /** @noinspection PhpVoidFunctionResultUsedInspection */ + /** @var DateInterval $dateInterval */ + $dateInterval = parent::__set_state($dump); + + return static::instance($dateInterval); + } + /** * Return the current context from inside a macro callee or a new one if static. * @@ -767,6 +883,8 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface case 'year': case 'years': case 'y': + case 'yr': + case 'yrs': $years += $intValue; break; @@ -780,6 +898,7 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface case 'month': case 'months': case 'mo': + case 'mos': $months += $intValue; break; @@ -882,7 +1001,7 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface return static::fromString(Carbon::translateTimeString($interval, $locale ?: static::getLocale(), 'en')); } - private static function castIntervalToClass(DateInterval $interval, string $className) + private static function castIntervalToClass(DateInterval $interval, string $className, array $skip = []) { $mainClass = DateInterval::class; @@ -891,7 +1010,7 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface } $microseconds = $interval->f; - $instance = new $className(static::getDateIntervalSpec($interval)); + $instance = new $className(static::getDateIntervalSpec($interval, false, $skip)); if ($microseconds) { $instance->f = $microseconds; @@ -940,12 +1059,19 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface * set the $days field. * * @param DateInterval $interval + * @param bool $skipCopy set to true to return the passed object + * (without copying it) if it's already of the + * current class * * @return static */ - public static function instance(DateInterval $interval) + public static function instance(DateInterval $interval, array $skip = [], bool $skipCopy = false) { - return self::castIntervalToClass($interval, static::class); + if ($skipCopy && $interval instanceof static) { + return $interval; + } + + return self::castIntervalToClass($interval, static::class, $skip); } /** @@ -956,17 +1082,20 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface * * @param mixed|int|DateInterval|string|Closure|null $interval interval or number of the given $unit * @param string|null $unit if specified, $interval must be an integer + * @param bool $skipCopy set to true to return the passed object + * (without copying it) if it's already of the + * current class * * @return static|null */ - public static function make($interval, $unit = null) + public static function make($interval, $unit = null, bool $skipCopy = false) { if ($unit) { $interval = "$interval ".Carbon::pluralUnit($unit); } if ($interval instanceof DateInterval) { - return static::instance($interval); + return static::instance($interval, [], $skipCopy); } if ($interval instanceof Closure) { @@ -984,7 +1113,7 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface { $interval = preg_replace('/\s+/', ' ', trim($interval)); - if (preg_match('/^P[T0-9]/', $interval)) { + if (preg_match('/^P[T\d]/', $interval)) { return new static($interval); } @@ -992,8 +1121,14 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface return static::fromString($interval); } - /** @var static $interval */ - $interval = static::createFromDateString($interval); + // @codeCoverageIgnoreStart + try { + /** @var static $interval */ + $interval = static::createFromDateString($interval); + } catch (DateMalformedIntervalStringException $e) { + return null; + } + // @codeCoverageIgnoreEnd return !$interval || $interval->isEmpty() ? null : $interval; } @@ -1081,11 +1216,11 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface return (int) round($this->f * Carbon::MICROSECONDS_PER_SECOND) % Carbon::MICROSECONDS_PER_MILLISECOND; case 'weeks': - return (int) ($this->d / static::getDaysPerWeek()); + return (int) ($this->d / (int) static::getDaysPerWeek()); case 'daysExcludeWeeks': case 'dayzExcludeWeeks': - return $this->d % static::getDaysPerWeek(); + return $this->d % (int) static::getDaysPerWeek(); case 'locale': return $this->getTranslatorLocale(); @@ -1126,43 +1261,63 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface foreach ($properties as $key => $value) { switch (Carbon::singularUnit(rtrim($key, 'z'))) { case 'year': + $this->checkIntegerValue($key, $value); $this->y = $value; + $this->handleDecimalPart('year', $value, $this->y); break; case 'month': + $this->checkIntegerValue($key, $value); $this->m = $value; + $this->handleDecimalPart('month', $value, $this->m); break; case 'week': - $this->d = $value * static::getDaysPerWeek(); + $this->checkIntegerValue($key, $value); + $days = $value * (int) static::getDaysPerWeek(); + $this->assertSafeForInteger('days total (including weeks)', $days); + $this->d = $days; + $this->handleDecimalPart('day', $days, $this->d); break; case 'day': + $this->checkIntegerValue($key, $value); $this->d = $value; + $this->handleDecimalPart('day', $value, $this->d); break; case 'daysexcludeweek': case 'dayzexcludeweek': - $this->d = $this->weeks * static::getDaysPerWeek() + $value; + $this->checkIntegerValue($key, $value); + $days = $this->weeks * (int) static::getDaysPerWeek() + $value; + $this->assertSafeForInteger('days total (including weeks)', $days); + $this->d = $days; + $this->handleDecimalPart('day', $days, $this->d); break; case 'hour': + $this->checkIntegerValue($key, $value); $this->h = $value; + $this->handleDecimalPart('hour', $value, $this->h); break; case 'minute': + $this->checkIntegerValue($key, $value); $this->i = $value; + $this->handleDecimalPart('minute', $value, $this->i); break; case 'second': + $this->checkIntegerValue($key, $value); $this->s = $value; + $this->handleDecimalPart('second', $value, $this->s); break; @@ -1355,11 +1510,15 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface } if (preg_match('/^(?add|sub)(?[A-Z].*)$/', $method, $match)) { - return $this->{$match['method']}($parameters[0], $match['unit']); + $value = $this->getMagicParameter($parameters, 0, Carbon::pluralUnit($match['unit']), 0); + + return $this->{$match['method']}($value, $match['unit']); } + $value = $this->getMagicParameter($parameters, 0, Carbon::pluralUnit($method), 1); + try { - $this->set($method, \count($parameters) === 0 ? 1 : $parameters[0]); + $this->set($method, $value); } catch (UnknownSetterException $exception) { if ($this->localStrictModeEnabled ?? Carbon::isStrictModeEnabled()) { throw new BadFluentSetterException($method, 0, $exception); @@ -1410,9 +1569,9 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface $minimumUnit = 's'; $skip = []; extract($this->getForHumansInitialVariables($syntax, $short)); - $skip = array_filter((array) $skip, static function ($value) { + $skip = array_map('strtolower', array_filter((array) $skip, static function ($value) { return \is_string($value) && $value !== ''; - }); + })); if ($syntax === null) { $syntax = CarbonInterface::DIFF_ABSOLUTE; @@ -1435,11 +1594,9 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface ]; } - if ($altNumbers) { - if ($altNumbers !== true) { - $language = new Language($this->locale); - $altNumbers = \in_array($language->getCode(), (array) $altNumbers); - } + if ($altNumbers && $altNumbers !== true) { + $language = new Language($this->locale); + $altNumbers = \in_array($language->getCode(), (array) $altNumbers, true); } if (\is_array($join)) { @@ -1620,18 +1777,23 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface $unit = $short ? 's' : 'second'; $isFuture = $this->invert === 1; $transId = $relativeToNow ? ($isFuture ? 'from_now' : 'ago') : ($isFuture ? 'after' : 'before'); + $declensionMode = null; /** @var \Symfony\Component\Translation\Translator $translator */ $translator = $this->getLocalTranslator(); - $handleDeclensions = function ($unit, $count) use ($interpolations, $transId, $translator, $altNumbers, $absolute) { + $handleDeclensions = function ($unit, $count, $index = 0, $parts = 1) use ($interpolations, $transId, $translator, $altNumbers, $absolute, &$declensionMode) { if (!$absolute) { - // Some languages have special pluralization for past and future tense. - $key = $unit.'_'.$transId; - $result = $this->translate($key, $interpolations, $count, $translator, $altNumbers); + $declensionMode = $declensionMode ?? $this->translate($transId.'_mode'); - if ($result !== $key) { - return $result; + if ($this->needsDeclension($declensionMode, $index, $parts)) { + // Some languages have special pluralization for past and future tense. + $key = $unit.'_'.$transId; + $result = $this->translate($key, $interpolations, $count, $translator, $altNumbers); + + if ($result !== $key) { + return $result; + } } } @@ -1696,17 +1858,17 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface } } - $transChoice = function ($short, $unitData) use ($absolute, $handleDeclensions, $translator, $aUnit, $altNumbers, $interpolations) { + $transChoice = function ($short, $unitData, $index, $parts) use ($absolute, $handleDeclensions, $translator, $aUnit, $altNumbers, $interpolations) { $count = $unitData['value']; if ($short) { - $result = $handleDeclensions($unitData['unitShort'], $count); + $result = $handleDeclensions($unitData['unitShort'], $count, $index, $parts); if ($result !== null) { return $result; } } elseif ($aUnit) { - $result = $handleDeclensions('a_'.$unitData['unit'], $count); + $result = $handleDeclensions('a_'.$unitData['unit'], $count, $index, $parts); if ($result !== null) { return $result; @@ -1714,7 +1876,7 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface } if (!$absolute) { - return $handleDeclensions($unitData['unit'], $count); + return $handleDeclensions($unitData['unit'], $count, $index, $parts); } return $this->translate($unitData['unit'], $interpolations, $count, $translator, $altNumbers); @@ -1726,7 +1888,7 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface if ($diffIntervalData['value'] > 0) { $unit = $short ? $diffIntervalData['unitShort'] : $diffIntervalData['unit']; $count = $diffIntervalData['value']; - $interval[] = $transChoice($short, $diffIntervalData); + $interval[] = [$short, $diffIntervalData]; } elseif ($options & CarbonInterface::SEQUENTIAL_PARTS_ONLY && \count($interval) > 0) { break; } @@ -1737,13 +1899,19 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface } // break the loop after we have reached the minimum unit - if (\in_array($minimumUnit, [$diffIntervalData['unit'], $diffIntervalData['unitShort']])) { + if (\in_array($minimumUnit, [$diffIntervalData['unit'], $diffIntervalData['unitShort']], true)) { $fallbackUnit = [$diffIntervalData['unit'], $diffIntervalData['unitShort']]; break; } } + $actualParts = \count($interval); + + foreach ($interval as $index => &$item) { + $item = $transChoice($item[0], $item[1], $index, $actualParts); + } + if (\count($interval) === 0) { if ($relativeToNow && $options & CarbonInterface::JUST_NOW) { $key = 'diff_now'; @@ -1812,17 +1980,17 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface */ public function __toString() { - $format = $this->localToStringFormat; + $format = $this->localToStringFormat ?? static::$toStringFormat; - if ($format) { - if ($format instanceof Closure) { - return $format($this); - } - - return $this->format($format); + if (!$format) { + return $this->forHumans(); } - return $this->forHumans(); + if ($format instanceof Closure) { + return $format($this); + } + + return $this->format($format); } /** @@ -1863,7 +2031,7 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface /** * Invert the interval. * - * @param bool|int $inverted if a parameter is passed, the passed value casted as 1 or 0 is used + * @param bool|int $inverted if a parameter is passed, the passed value cast as 1 or 0 is used * as the new value of the ->invert property. * * @return $this @@ -2141,7 +2309,7 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface * * @return string */ - public static function getDateIntervalSpec(DateInterval $interval) + public static function getDateIntervalSpec(DateInterval $interval, bool $microseconds = false, array $skip = []) { $date = array_filter([ static::PERIOD_YEARS => abs($interval->y), @@ -2149,10 +2317,25 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface static::PERIOD_DAYS => abs($interval->d), ]); + if ( + $interval->days >= CarbonInterface::DAYS_PER_WEEK * CarbonInterface::WEEKS_PER_MONTH && + (!isset($date[static::PERIOD_YEARS]) || \count(array_intersect(['y', 'year', 'years'], $skip))) && + (!isset($date[static::PERIOD_MONTHS]) || \count(array_intersect(['m', 'month', 'months'], $skip))) + ) { + $date = [ + static::PERIOD_DAYS => abs($interval->days), + ]; + } + + $seconds = abs($interval->s); + if ($microseconds && $interval->f > 0) { + $seconds = sprintf('%d.%06d', $seconds, abs($interval->f) * 1000000); + } + $time = array_filter([ static::PERIOD_HOURS => abs($interval->h), static::PERIOD_MINUTES => abs($interval->i), - static::PERIOD_SECONDS => abs($interval->s), + static::PERIOD_SECONDS => $seconds, ]); $specString = static::PERIOD_PREFIX; @@ -2176,9 +2359,9 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface * * @return string */ - public function spec() + public function spec(bool $microseconds = false) { - return static::getDateIntervalSpec($this); + return static::getDateIntervalSpec($this, $microseconds); } /** @@ -2229,9 +2412,11 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface $originalData = $this->toArray(); $originalData['milliseconds'] = (int) ($originalData['microseconds'] / static::getMicrosecondsPerMillisecond()); $originalData['microseconds'] = $originalData['microseconds'] % static::getMicrosecondsPerMillisecond(); - $originalData['daysExcludeWeeks'] = $originalData['days']; + $originalData['weeks'] = (int) ($this->d / static::getDaysPerWeek()); + $originalData['daysExcludeWeeks'] = fmod($this->d, static::getDaysPerWeek()); unset($originalData['days']); $newData = $originalData; + $previous = []; foreach (self::getFlipCascadeFactors() as $source => [$target, $factor]) { foreach (['source', 'target'] as $key) { @@ -2241,9 +2426,29 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface } $value = $newData[$source]; - $modulo = ($factor + ($value % $factor)) % $factor; + $modulo = fmod($factor + fmod($value, $factor), $factor); $newData[$source] = $modulo; $newData[$target] += ($value - $modulo) / $factor; + + $decimalPart = fmod($newData[$source], 1); + + if ($decimalPart !== 0.0) { + $unit = $source; + + foreach ($previous as [$subUnit, $subFactor]) { + $newData[$unit] -= $decimalPart; + $newData[$subUnit] += $decimalPart * $subFactor; + $decimalPart = fmod($newData[$subUnit], 1); + + if ($decimalPart === 0.0) { + break; + } + + $unit = $subUnit; + } + } + + array_unshift($previous, [$source, $factor]); } $positive = null; @@ -2324,13 +2529,13 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface $cumulativeFactor = 0; $unitFound = false; $factors = self::getFlipCascadeFactors(); - $daysPerWeek = static::getDaysPerWeek(); + $daysPerWeek = (int) static::getDaysPerWeek(); $values = [ 'years' => $this->years, 'months' => $this->months, 'weeks' => (int) ($this->d / $daysPerWeek), - 'dayz' => $this->d % $daysPerWeek, + 'dayz' => fmod($this->d, $daysPerWeek), 'hours' => $this->hours, 'minutes' => $this->minutes, 'seconds' => $this->seconds, @@ -2391,10 +2596,11 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface } if ($unit === 'weeks') { - return $result / $daysPerWeek; + $result /= $daysPerWeek; } - return $result; + // Cast as int numbers with no decimal part + return fmod($result, 1) === 0.0 ? (int) $result : $result; } /** @@ -2662,6 +2868,15 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface */ public function roundUnit($unit, $precision = 1, $function = 'round') { + if (static::getCascadeFactors() !== static::getDefaultCascadeFactors()) { + $value = $function($this->total($unit) / $precision) * $precision; + $inverted = $value < 0; + + return $this->copyProperties(self::fromString( + number_format(abs($value), 12, '.', '').' '.$unit + )->invert($inverted)->cascade()); + } + $base = CarbonImmutable::parse('2000-01-01 00:00:00', 'UTC') ->roundUnit($unit, $precision, $function); $next = $base->add($this); @@ -2752,4 +2967,88 @@ class CarbonInterval extends DateInterval implements CarbonConverterInterface { return $this->round($precision, 'ceil'); } + + private function needsDeclension(string $mode, int $index, int $parts): bool + { + switch ($mode) { + case 'last': + return $index === $parts - 1; + default: + return true; + } + } + + private function checkIntegerValue(string $name, $value) + { + if (\is_int($value)) { + return; + } + + $this->assertSafeForInteger($name, $value); + + if (\is_float($value) && (((float) (int) $value) === $value)) { + return; + } + + if (!self::$floatSettersEnabled) { + $type = \gettype($value); + @trigger_error( + "Since 2.70.0, it's deprecated to pass $type value for $name.\n". + "It's truncated when stored as an integer interval unit.\n". + "From 3.0.0, decimal part will no longer be truncated and will be cascaded to smaller units.\n". + "- To maintain the current behavior, use explicit cast: $name((int) \$value)\n". + "- To adopt the new behavior globally, call CarbonInterval::enableFloatSetters()\n", + \E_USER_DEPRECATED + ); + } + } + + /** + * Throw an exception if precision loss when storing the given value as an integer would be >= 1.0. + */ + private function assertSafeForInteger(string $name, $value) + { + if ($value && !\is_int($value) && ($value >= 0x7fffffffffffffff || $value <= -0x7fffffffffffffff)) { + throw new OutOfRangeException($name, -0x7fffffffffffffff, 0x7fffffffffffffff, $value); + } + } + + private function handleDecimalPart(string $unit, $value, $integerValue) + { + if (self::$floatSettersEnabled) { + $floatValue = (float) $value; + $base = (float) $integerValue; + + if ($floatValue === $base) { + return; + } + + $units = [ + 'y' => 'year', + 'm' => 'month', + 'd' => 'day', + 'h' => 'hour', + 'i' => 'minute', + 's' => 'second', + ]; + $upper = true; + + foreach ($units as $property => $name) { + if ($name === $unit) { + $upper = false; + + continue; + } + + if (!$upper && $this->$property !== 0) { + throw new RuntimeException( + "You cannot set $unit to a float value as $name would be overridden, ". + 'set it first to 0 explicitly if you really want to erase its value' + ); + } + } + + $this->add($unit, $floatValue - $base); + } + } } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php index 0e81e7573..d12a98697 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php @@ -11,6 +11,7 @@ namespace Carbon; +use Carbon\Exceptions\EndLessPeriodException; use Carbon\Exceptions\InvalidCastException; use Carbon\Exceptions\InvalidIntervalException; use Carbon\Exceptions\InvalidPeriodDateException; @@ -23,11 +24,13 @@ use Carbon\Exceptions\UnreachableException; use Carbon\Traits\IntervalRounding; use Carbon\Traits\Mixin; use Carbon\Traits\Options; +use Carbon\Traits\ToStringFormat; use Closure; use Countable; use DateInterval; use DatePeriod; use DateTime; +use DateTimeImmutable; use DateTimeInterface; use DateTimeZone; use InvalidArgumentException; @@ -48,43 +51,47 @@ use RuntimeException; * @property-read CarbonInterface $end Period end date. * @property-read CarbonInterval $interval Underlying date interval instance. Always present, one day by default. * - * @method static CarbonPeriod start($date, $inclusive = null) Create instance specifying start date or modify the start date if called on an instance. - * @method static CarbonPeriod since($date, $inclusive = null) Alias for start(). - * @method static CarbonPeriod sinceNow($inclusive = null) Create instance with start date set to now or set the start date to now if called on an instance. - * @method static CarbonPeriod end($date = null, $inclusive = null) Create instance specifying end date or modify the end date if called on an instance. - * @method static CarbonPeriod until($date = null, $inclusive = null) Alias for end(). - * @method static CarbonPeriod untilNow($inclusive = null) Create instance with end date set to now or set the end date to now if called on an instance. - * @method static CarbonPeriod dates($start, $end = null) Create instance with start and end dates or modify the start and end dates if called on an instance. - * @method static CarbonPeriod between($start, $end = null) Create instance with start and end dates or modify the start and end dates if called on an instance. - * @method static CarbonPeriod recurrences($recurrences = null) Create instance with maximum number of recurrences or modify the number of recurrences if called on an instance. - * @method static CarbonPeriod times($recurrences = null) Alias for recurrences(). - * @method static CarbonPeriod options($options = null) Create instance with options or modify the options if called on an instance. - * @method static CarbonPeriod toggle($options, $state = null) Create instance with options toggled on or off, or toggle options if called on an instance. - * @method static CarbonPeriod filter($callback, $name = null) Create instance with filter added to the stack or append a filter if called on an instance. - * @method static CarbonPeriod push($callback, $name = null) Alias for filter(). - * @method static CarbonPeriod prepend($callback, $name = null) Create instance with filter prepended to the stack or prepend a filter if called on an instance. - * @method static CarbonPeriod filters(array $filters = []) Create instance with filters stack or replace the whole filters stack if called on an instance. - * @method static CarbonPeriod interval($interval) Create instance with given date interval or modify the interval if called on an instance. - * @method static CarbonPeriod each($interval) Create instance with given date interval or modify the interval if called on an instance. - * @method static CarbonPeriod every($interval) Create instance with given date interval or modify the interval if called on an instance. - * @method static CarbonPeriod step($interval) Create instance with given date interval or modify the interval if called on an instance. - * @method static CarbonPeriod stepBy($interval) Create instance with given date interval or modify the interval if called on an instance. - * @method static CarbonPeriod invert() Create instance with inverted date interval or invert the interval if called on an instance. - * @method static CarbonPeriod years($years = 1) Create instance specifying a number of years for date interval or replace the interval by the given a number of years if called on an instance. - * @method static CarbonPeriod year($years = 1) Alias for years(). - * @method static CarbonPeriod months($months = 1) Create instance specifying a number of months for date interval or replace the interval by the given a number of months if called on an instance. - * @method static CarbonPeriod month($months = 1) Alias for months(). - * @method static CarbonPeriod weeks($weeks = 1) Create instance specifying a number of weeks for date interval or replace the interval by the given a number of weeks if called on an instance. - * @method static CarbonPeriod week($weeks = 1) Alias for weeks(). - * @method static CarbonPeriod days($days = 1) Create instance specifying a number of days for date interval or replace the interval by the given a number of days if called on an instance. - * @method static CarbonPeriod dayz($days = 1) Alias for days(). - * @method static CarbonPeriod day($days = 1) Alias for days(). - * @method static CarbonPeriod hours($hours = 1) Create instance specifying a number of hours for date interval or replace the interval by the given a number of hours if called on an instance. - * @method static CarbonPeriod hour($hours = 1) Alias for hours(). - * @method static CarbonPeriod minutes($minutes = 1) Create instance specifying a number of minutes for date interval or replace the interval by the given a number of minutes if called on an instance. - * @method static CarbonPeriod minute($minutes = 1) Alias for minutes(). - * @method static CarbonPeriod seconds($seconds = 1) Create instance specifying a number of seconds for date interval or replace the interval by the given a number of seconds if called on an instance. - * @method static CarbonPeriod second($seconds = 1) Alias for seconds(). + * @method static static start($date, $inclusive = null) Create instance specifying start date or modify the start date if called on an instance. + * @method static static since($date, $inclusive = null) Alias for start(). + * @method static static sinceNow($inclusive = null) Create instance with start date set to now or set the start date to now if called on an instance. + * @method static static end($date = null, $inclusive = null) Create instance specifying end date or modify the end date if called on an instance. + * @method static static until($date = null, $inclusive = null) Alias for end(). + * @method static static untilNow($inclusive = null) Create instance with end date set to now or set the end date to now if called on an instance. + * @method static static dates($start, $end = null) Create instance with start and end dates or modify the start and end dates if called on an instance. + * @method static static between($start, $end = null) Create instance with start and end dates or modify the start and end dates if called on an instance. + * @method static static recurrences($recurrences = null) Create instance with maximum number of recurrences or modify the number of recurrences if called on an instance. + * @method static static times($recurrences = null) Alias for recurrences(). + * @method static static options($options = null) Create instance with options or modify the options if called on an instance. + * @method static static toggle($options, $state = null) Create instance with options toggled on or off, or toggle options if called on an instance. + * @method static static filter($callback, $name = null) Create instance with filter added to the stack or append a filter if called on an instance. + * @method static static push($callback, $name = null) Alias for filter(). + * @method static static prepend($callback, $name = null) Create instance with filter prepended to the stack or prepend a filter if called on an instance. + * @method static static filters(array $filters = []) Create instance with filters stack or replace the whole filters stack if called on an instance. + * @method static static interval($interval) Create instance with given date interval or modify the interval if called on an instance. + * @method static static each($interval) Create instance with given date interval or modify the interval if called on an instance. + * @method static static every($interval) Create instance with given date interval or modify the interval if called on an instance. + * @method static static step($interval) Create instance with given date interval or modify the interval if called on an instance. + * @method static static stepBy($interval) Create instance with given date interval or modify the interval if called on an instance. + * @method static static invert() Create instance with inverted date interval or invert the interval if called on an instance. + * @method static static years($years = 1) Create instance specifying a number of years for date interval or replace the interval by the given a number of years if called on an instance. + * @method static static year($years = 1) Alias for years(). + * @method static static months($months = 1) Create instance specifying a number of months for date interval or replace the interval by the given a number of months if called on an instance. + * @method static static month($months = 1) Alias for months(). + * @method static static weeks($weeks = 1) Create instance specifying a number of weeks for date interval or replace the interval by the given a number of weeks if called on an instance. + * @method static static week($weeks = 1) Alias for weeks(). + * @method static static days($days = 1) Create instance specifying a number of days for date interval or replace the interval by the given a number of days if called on an instance. + * @method static static dayz($days = 1) Alias for days(). + * @method static static day($days = 1) Alias for days(). + * @method static static hours($hours = 1) Create instance specifying a number of hours for date interval or replace the interval by the given a number of hours if called on an instance. + * @method static static hour($hours = 1) Alias for hours(). + * @method static static minutes($minutes = 1) Create instance specifying a number of minutes for date interval or replace the interval by the given a number of minutes if called on an instance. + * @method static static minute($minutes = 1) Alias for minutes(). + * @method static static seconds($seconds = 1) Create instance specifying a number of seconds for date interval or replace the interval by the given a number of seconds if called on an instance. + * @method static static second($seconds = 1) Alias for seconds(). + * @method static static milliseconds($milliseconds = 1) Create instance specifying a number of milliseconds for date interval or replace the interval by the given a number of milliseconds if called on an instance. + * @method static static millisecond($milliseconds = 1) Alias for milliseconds(). + * @method static static microseconds($microseconds = 1) Create instance specifying a number of microseconds for date interval or replace the interval by the given a number of microseconds if called on an instance. + * @method static static microsecond($microseconds = 1) Alias for microseconds(). * @method $this roundYear(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. * @method $this roundYears(float $precision = 1, string $function = "round") Round the current instance year with given precision using the given function. * @method $this floorYear(float $precision = 1) Truncate the current instance year with given precision. @@ -173,6 +180,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable Mixin::mixin as baseMixin; } use Options; + use ToStringFormat; /** * Built-in filter for limit by recurrences. @@ -230,6 +238,13 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable */ public const END_MAX_ATTEMPTS = 10000; + /** + * Default date class of iteration items. + * + * @var string + */ + protected const DEFAULT_DATE_CLASS = Carbon::class; + /** * The registered macros. * @@ -251,6 +266,13 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable */ protected $dateInterval; + /** + * True once __construct is finished. + * + * @var bool + */ + protected $constructed = false; + /** * Whether current date interval was set by default. * @@ -377,7 +399,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable ); } - $class = \get_called_class(); + $class = static::class; $type = \gettype($period); throw new NotAPeriodException( @@ -482,15 +504,16 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable $interval = null; $start = null; $end = null; + $dateClass = static::DEFAULT_DATE_CLASS; foreach (explode('/', $iso) as $key => $part) { - if ($key === 0 && preg_match('/^R([0-9]*|INF)$/', $part, $match)) { + if ($key === 0 && preg_match('/^R(\d*|INF)$/', $part, $match)) { $parsed = \strlen($match[1]) ? (($match[1] !== 'INF') ? (int) $match[1] : INF) : null; } elseif ($interval === null && $parsed = CarbonInterval::make($part)) { $interval = $part; - } elseif ($start === null && $parsed = Carbon::make($part)) { + } elseif ($start === null && $parsed = $dateClass::make($part)) { $start = $part; - } elseif ($end === null && $parsed = Carbon::make(static::addMissingParts($start ?? '', $part))) { + } elseif ($end === null && $parsed = $dateClass::make(static::addMissingParts($start ?? '', $part))) { $end = $part; } else { throw new InvalidPeriodParameterException("Invalid ISO 8601 specification: $iso."); @@ -503,7 +526,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable } /** - * Add missing parts of the target date from the soure date. + * Add missing parts of the target date from the source date. * * @param string $source * @param string $target @@ -512,7 +535,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable */ protected static function addMissingParts($source, $target) { - $pattern = '/'.preg_replace('/[0-9]+/', '[0-9]+', preg_quote($target, '/')).'$/'; + $pattern = '/'.preg_replace('/\d+/', '[0-9]+', preg_quote($target, '/')).'$/'; $result = preg_replace($pattern, $target, $source, 1, $count); @@ -621,6 +644,10 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable */ public function __construct(...$arguments) { + if (is_a($this->dateClass, DateTimeImmutable::class, true)) { + $this->options = static::IMMUTABLE; + } + // Parse and assign arguments one by one. First argument may be an ISO 8601 spec, // which will be first parsed into parts and then processed the same way. @@ -648,6 +675,8 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable } } + $optionsSet = false; + foreach ($arguments as $argument) { $parsedDate = null; @@ -655,10 +684,10 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable $this->setTimezone($argument); } elseif ($this->dateInterval === null && ( - \is_string($argument) && preg_match( - '/^(-?\d(\d(?![\/-])|[^\d\/-]([\/-])?)*|P[T0-9].*|(?:\h*\d+(?:\.\d+)?\h*[a-z]+)+)$/i', + (\is_string($argument) && preg_match( + '/^(-?\d(\d(?![\/-])|[^\d\/-]([\/-])?)*|P[T\d].*|(?:\h*\d+(?:\.\d+)?\h*[a-z]+)+)$/i', $argument - ) || + )) || $argument instanceof DateInterval || $argument instanceof Closure ) && @@ -671,15 +700,17 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable $this->setEndDate($parsedDate); } elseif ($this->recurrences === null && $this->endDate === null && is_numeric($argument)) { $this->setRecurrences($argument); - } elseif ($this->options === null && (\is_int($argument) || $argument === null)) { - $this->setOptions($argument); + } elseif (!$optionsSet && (\is_int($argument) || $argument === null)) { + $optionsSet = true; + $this->setOptions(((int) $this->options) | ((int) $argument)); } else { throw new InvalidPeriodParameterException('Invalid constructor parameters.'); } } if ($this->startDate === null) { - $this->setStartDate(Carbon::now()); + $dateClass = $this->dateClass; + $this->setStartDate($dateClass::now()); } if ($this->dateInterval === null) { @@ -691,6 +722,8 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable if ($this->options === null) { $this->setOptions(0); } + + $this->constructed = true; } /** @@ -703,6 +736,17 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable return clone $this; } + /** + * Prepare the instance to be set (self if mutable to be mutated, + * copy if immutable to generate a new instance). + * + * @return static + */ + protected function copyIfImmutable() + { + return $this; + } + /** * Get the getter for a property allowing both `DatePeriod` snakeCase and camelCase names. * @@ -794,7 +838,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @param string $dateClass * - * @return $this + * @return static */ public function setDateClass(string $dateClass) { @@ -802,15 +846,16 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable throw new NotACarbonClassException($dateClass); } - $this->dateClass = $dateClass; + $self = $this->copyIfImmutable(); + $self->dateClass = $dateClass; if (is_a($dateClass, Carbon::class, true)) { - $this->toggleOptions(static::IMMUTABLE, false); + $self->options = $self->options & ~static::IMMUTABLE; } elseif (is_a($dateClass, CarbonImmutable::class, true)) { - $this->toggleOptions(static::IMMUTABLE, true); + $self->options = $self->options | static::IMMUTABLE; } - return $this; + return $self; } /** @@ -830,7 +875,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @throws InvalidIntervalException * - * @return $this + * @return static */ public function setDateInterval($interval) { @@ -842,25 +887,24 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable throw new InvalidIntervalException('Empty interval is not accepted.'); } - $this->dateInterval = $interval; + $self = $this->copyIfImmutable(); + $self->dateInterval = $interval; - $this->isDefaultInterval = false; + $self->isDefaultInterval = false; - $this->handleChangedParameters(); + $self->handleChangedParameters(); - return $this; + return $self; } /** * Invert the period date interval. * - * @return $this + * @return static */ public function invertDateInterval() { - $interval = $this->dateInterval->invert(); - - return $this->setDateInterval($interval); + return $this->setDateInterval($this->dateInterval->invert()); } /** @@ -869,14 +913,11 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * @param DateTime|DateTimeInterface|string $start * @param DateTime|DateTimeInterface|string|null $end * - * @return $this + * @return static */ public function setDates($start, $end) { - $this->setStartDate($start); - $this->setEndDate($end); - - return $this; + return $this->setStartDate($start)->setEndDate($end); } /** @@ -886,7 +927,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @throws InvalidArgumentException * - * @return $this + * @return static */ public function setOptions($options) { @@ -894,11 +935,12 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable throw new InvalidPeriodParameterException('Invalid options.'); } - $this->options = $options ?: 0; + $self = $this->copyIfImmutable(); + $self->options = $options ?: 0; - $this->handleChangedParameters(); + $self->handleChangedParameters(); - return $this; + return $self; } /** @@ -919,7 +961,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @throws \InvalidArgumentException * - * @return $this + * @return static */ public function toggleOptions($options, $state = null) { @@ -939,7 +981,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @param bool $state * - * @return $this + * @return static */ public function excludeStartDate($state = true) { @@ -951,7 +993,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @param bool $state * - * @return $this + * @return static */ public function excludeEndDate($state = true) { @@ -1095,17 +1137,18 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * @param callable $callback * @param string $name * - * @return $this + * @return static */ public function addFilter($callback, $name = null) { - $tuple = $this->createFilterTuple(\func_get_args()); + $self = $this->copyIfImmutable(); + $tuple = $self->createFilterTuple(\func_get_args()); - $this->filters[] = $tuple; + $self->filters[] = $tuple; - $this->handleChangedParameters(); + $self->handleChangedParameters(); - return $this; + return $self; } /** @@ -1116,17 +1159,18 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * @param callable $callback * @param string $name * - * @return $this + * @return static */ public function prependFilter($callback, $name = null) { - $tuple = $this->createFilterTuple(\func_get_args()); + $self = $this->copyIfImmutable(); + $tuple = $self->createFilterTuple(\func_get_args()); - array_unshift($this->filters, $tuple); + array_unshift($self->filters, $tuple); - $this->handleChangedParameters(); + $self->handleChangedParameters(); - return $this; + return $self; } /** @@ -1134,24 +1178,25 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @param callable|string $filter * - * @return $this + * @return static */ public function removeFilter($filter) { + $self = $this->copyIfImmutable(); $key = \is_callable($filter) ? 0 : 1; - $this->filters = array_values(array_filter( + $self->filters = array_values(array_filter( $this->filters, function ($tuple) use ($key, $filter) { return $tuple[$key] !== $filter; } )); - $this->updateInternalState(); + $self->updateInternalState(); - $this->handleChangedParameters(); + $self->handleChangedParameters(); - return $this; + return $self; } /** @@ -1189,39 +1234,41 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @param array $filters * - * @return $this + * @return static */ public function setFilters(array $filters) { - $this->filters = $filters; + $self = $this->copyIfImmutable(); + $self->filters = $filters; - $this->updateInternalState(); + $self->updateInternalState(); - $this->handleChangedParameters(); + $self->handleChangedParameters(); - return $this; + return $self; } /** * Reset filters stack. * - * @return $this + * @return static */ public function resetFilters() { - $this->filters = []; + $self = $this->copyIfImmutable(); + $self->filters = []; - if ($this->endDate !== null) { - $this->filters[] = [static::END_DATE_FILTER, null]; + if ($self->endDate !== null) { + $self->filters[] = [static::END_DATE_FILTER, null]; } - if ($this->recurrences !== null) { - $this->filters[] = [static::RECURRENCES_FILTER, null]; + if ($self->recurrences !== null) { + $self->filters[] = [static::RECURRENCES_FILTER, null]; } - $this->handleChangedParameters(); + $self->handleChangedParameters(); - return $this; + return $self; } /** @@ -1231,11 +1278,11 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @throws InvalidArgumentException * - * @return $this + * @return static */ public function setRecurrences($recurrences) { - if (!is_numeric($recurrences) && $recurrences !== null || $recurrences < 0) { + if ((!is_numeric($recurrences) && $recurrences !== null) || $recurrences < 0) { throw new InvalidPeriodParameterException('Invalid number of recurrences.'); } @@ -1243,15 +1290,17 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable return $this->removeFilter(static::RECURRENCES_FILTER); } - $this->recurrences = $recurrences === INF ? INF : (int) $recurrences; + /** @var self $self */ + $self = $this->copyIfImmutable(); + $self->recurrences = $recurrences === INF ? INF : (int) $recurrences; - if (!$this->hasFilter(static::RECURRENCES_FILTER)) { - return $this->addFilter(static::RECURRENCES_FILTER); + if (!$self->hasFilter(static::RECURRENCES_FILTER)) { + return $self->addFilter(static::RECURRENCES_FILTER); } - $this->handleChangedParameters(); + $self->handleChangedParameters(); - return $this; + return $self; } /** @@ -1262,21 +1311,22 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @throws InvalidPeriodDateException * - * @return $this + * @return static */ public function setStartDate($date, $inclusive = null) { - if (!$date = ([$this->dateClass, 'make'])($date)) { + if (!$this->isInfiniteDate($date) && !($date = ([$this->dateClass, 'make'])($date))) { throw new InvalidPeriodDateException('Invalid start date.'); } - $this->startDate = $date; + $self = $this->copyIfImmutable(); + $self->startDate = $date; if ($inclusive !== null) { - $this->toggleOptions(static::EXCLUDE_START_DATE, !$inclusive); + $self = $self->toggleOptions(static::EXCLUDE_START_DATE, !$inclusive); } - return $this; + return $self; } /** @@ -1287,11 +1337,11 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @throws \InvalidArgumentException * - * @return $this + * @return static */ public function setEndDate($date, $inclusive = null) { - if ($date !== null && !$date = ([$this->dateClass, 'make'])($date)) { + if ($date !== null && !$this->isInfiniteDate($date) && !$date = ([$this->dateClass, 'make'])($date)) { throw new InvalidPeriodDateException('Invalid end date.'); } @@ -1299,19 +1349,20 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable return $this->removeFilter(static::END_DATE_FILTER); } - $this->endDate = $date; + $self = $this->copyIfImmutable(); + $self->endDate = $date; if ($inclusive !== null) { - $this->toggleOptions(static::EXCLUDE_END_DATE, !$inclusive); + $self = $self->toggleOptions(static::EXCLUDE_END_DATE, !$inclusive); } - if (!$this->hasFilter(static::END_DATE_FILTER)) { - return $this->addFilter(static::END_DATE_FILTER); + if (!$self->hasFilter(static::END_DATE_FILTER)) { + return $self->addFilter(static::END_DATE_FILTER); } - $this->handleChangedParameters(); + $self->handleChangedParameters(); - return $this; + return $self; } /** @@ -1457,13 +1508,21 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable */ public function toString() { + $format = $this->localToStringFormat ?? static::$toStringFormat; + + if ($format instanceof Closure) { + return $format($this); + } + $translator = ([$this->dateClass, 'getTranslator'])(); $parts = []; - $format = !$this->startDate->isStartOfDay() || $this->endDate && !$this->endDate->isStartOfDay() - ? 'Y-m-d H:i:s' - : 'Y-m-d'; + $format = $format ?? ( + !$this->startDate->isStartOfDay() || ($this->endDate && !$this->endDate->isStartOfDay()) + ? 'Y-m-d H:i:s' + : 'Y-m-d' + ); if ($this->recurrences !== null) { $parts[] = $this->translate('period_recurrences', [], $this->recurrences, $translator); @@ -1506,9 +1565,9 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable if (!method_exists($className, 'instance')) { if (is_a($className, DatePeriod::class, true)) { return new $className( - $this->getStartDate(), + $this->rawDate($this->getStartDate()), $this->getDateInterval(), - $this->getEndDate() ? $this->getIncludedEndDate() : $this->getRecurrences(), + $this->getEndDate() ? $this->rawDate($this->getIncludedEndDate()) : $this->getRecurrences(), $this->isStartExcluded() ? DatePeriod::EXCLUDE_START_DATE : 0 ); } @@ -1534,6 +1593,39 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable return $this->cast(DatePeriod::class); } + /** + * Return `true` if the period has no custom filter and is guaranteed to be endless. + * + * Note that we can't check if a period is endless as soon as it has custom filters + * because filters can emit `CarbonPeriod::END_ITERATION` to stop the iteration in + * a way we can't predict without actually iterating the period. + */ + public function isUnfilteredAndEndLess(): bool + { + foreach ($this->filters as $filter) { + switch ($filter) { + case [static::RECURRENCES_FILTER, null]: + if ($this->recurrences !== null && is_finite($this->recurrences)) { + return false; + } + + break; + + case [static::END_DATE_FILTER, null]: + if ($this->endDate !== null && !$this->endDate->isEndOfTime()) { + return false; + } + + break; + + default: + return false; + } + } + + return true; + } + /** * Convert the date period into an array without changing current iteration state. * @@ -1541,6 +1633,10 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable */ public function toArray() { + if ($this->isUnfilteredAndEndLess()) { + throw new EndLessPeriodException("Endless period can't be converted to array nor counted."); + } + $state = [ $this->key, $this->current ? $this->current->avoidMutation() : null, @@ -1572,6 +1668,16 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable */ public function first() { + if ($this->isUnfilteredAndEndLess()) { + foreach ($this as $date) { + $this->rewind(); + + return $date; + } + + return null; + } + return ($this->toArray() ?: [])[0] ?? null; } @@ -1626,54 +1732,80 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable return $roundedValue; } - $first = \count($parameters) >= 1 ? $parameters[0] : null; - $second = \count($parameters) >= 2 ? $parameters[1] : null; - switch ($method) { case 'start': case 'since': - return $this->setStartDate($first, $second); + self::setDefaultParameters($parameters, [ + [0, 'date', null], + ]); + + return $this->setStartDate(...$parameters); case 'sinceNow': - return $this->setStartDate(new Carbon(), $first); + return $this->setStartDate(new Carbon(), ...$parameters); case 'end': case 'until': - return $this->setEndDate($first, $second); + self::setDefaultParameters($parameters, [ + [0, 'date', null], + ]); + + return $this->setEndDate(...$parameters); case 'untilNow': - return $this->setEndDate(new Carbon(), $first); + return $this->setEndDate(new Carbon(), ...$parameters); case 'dates': case 'between': - return $this->setDates($first, $second); + self::setDefaultParameters($parameters, [ + [0, 'start', null], + [1, 'end', null], + ]); + + return $this->setDates(...$parameters); case 'recurrences': case 'times': - return $this->setRecurrences($first); + self::setDefaultParameters($parameters, [ + [0, 'recurrences', null], + ]); + + return $this->setRecurrences(...$parameters); case 'options': - return $this->setOptions($first); + self::setDefaultParameters($parameters, [ + [0, 'options', null], + ]); + + return $this->setOptions(...$parameters); case 'toggle': - return $this->toggleOptions($first, $second); + self::setDefaultParameters($parameters, [ + [0, 'options', null], + ]); + + return $this->toggleOptions(...$parameters); case 'filter': case 'push': - return $this->addFilter($first, $second); + return $this->addFilter(...$parameters); case 'prepend': - return $this->prependFilter($first, $second); + return $this->prependFilter(...$parameters); case 'filters': - return $this->setFilters($first ?: []); + self::setDefaultParameters($parameters, [ + [0, 'filters', []], + ]); + + return $this->setFilters(...$parameters); case 'interval': case 'each': case 'every': case 'step': case 'stepBy': - return $this->setDateInterval($first); + return $this->setDateInterval(...$parameters); case 'invert': return $this->invertDateInterval(); @@ -1693,15 +1825,19 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable case 'minute': case 'seconds': case 'second': + case 'milliseconds': + case 'millisecond': + case 'microseconds': + case 'microsecond': return $this->setDateInterval(( // Override default P1D when instantiating via fluent setters. [$this->isDefaultInterval ? new CarbonInterval('PT0S') : $this->dateInterval, $method] - )( - \count($parameters) === 0 ? 1 : $first - )); + )(...$parameters)); } - if ($this->localStrictModeEnabled ?? Carbon::isStrictModeEnabled()) { + $dateClass = $this->dateClass; + + if ($this->localStrictModeEnabled ?? $dateClass::isStrictModeEnabled()) { throw new UnknownMethodException($method); } @@ -1717,18 +1853,19 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable */ public function setTimezone($timezone) { - $this->tzName = $timezone; - $this->timezone = $timezone; + $self = $this->copyIfImmutable(); + $self->tzName = $timezone; + $self->timezone = $timezone; - if ($this->startDate) { - $this->setStartDate($this->startDate->setTimezone($timezone)); + if ($self->startDate) { + $self = $self->setStartDate($self->startDate->setTimezone($timezone)); } - if ($this->endDate) { - $this->setEndDate($this->endDate->setTimezone($timezone)); + if ($self->endDate) { + $self = $self->setEndDate($self->endDate->setTimezone($timezone)); } - return $this; + return $self; } /** @@ -1740,18 +1877,19 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable */ public function shiftTimezone($timezone) { - $this->tzName = $timezone; - $this->timezone = $timezone; + $self = $this->copyIfImmutable(); + $self->tzName = $timezone; + $self->timezone = $timezone; - if ($this->startDate) { - $this->setStartDate($this->startDate->shiftTimezone($timezone)); + if ($self->startDate) { + $self = $self->setStartDate($self->startDate->shiftTimezone($timezone)); } - if ($this->endDate) { - $this->setEndDate($this->endDate->shiftTimezone($timezone)); + if ($self->endDate) { + $self = $self->setEndDate($self->endDate->shiftTimezone($timezone)); } - return $this; + return $self; } /** @@ -1896,7 +2034,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable /** * Determines if the instance is equal to another. - * Warning: if options differ, instances wil never be equal. + * Warning: if options differ, instances will never be equal. * * @param mixed $period * @@ -1911,7 +2049,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable /** * Determines if the instance is equal to another. - * Warning: if options differ, instances wil never be equal. + * Warning: if options differ, instances will never be equal. * * @param mixed $period * @@ -1934,7 +2072,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable /** * Determines if the instance is not equal to another. - * Warning: if options differ, instances wil never be equal. + * Warning: if options differ, instances will never be equal. * * @param mixed $period * @@ -1949,7 +2087,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable /** * Determines if the instance is not equal to another. - * Warning: if options differ, instances wil never be equal. + * Warning: if options differ, instances will never be equal. * * @param mixed $period * @@ -2130,19 +2268,18 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * @param float|int|string|\DateInterval|null $precision * @param string $function * - * @return $this + * @return static */ public function roundUnit($unit, $precision = 1, $function = 'round') { - $this->setStartDate($this->getStartDate()->roundUnit($unit, $precision, $function)); + $self = $this->copyIfImmutable(); + $self = $self->setStartDate($self->getStartDate()->roundUnit($unit, $precision, $function)); - if ($this->endDate) { - $this->setEndDate($this->getEndDate()->roundUnit($unit, $precision, $function)); + if ($self->endDate) { + $self = $self->setEndDate($self->getEndDate()->roundUnit($unit, $precision, $function)); } - $this->setDateInterval($this->getDateInterval()->roundUnit($unit, $precision, $function)); - - return $this; + return $self->setDateInterval($self->getDateInterval()->roundUnit($unit, $precision, $function)); } /** @@ -2151,7 +2288,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * @param string $unit * @param float|int|string|\DateInterval|null $precision * - * @return $this + * @return static */ public function floorUnit($unit, $precision = 1) { @@ -2164,7 +2301,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * @param string $unit * @param float|int|string|\DateInterval|null $precision * - * @return $this + * @return static */ public function ceilUnit($unit, $precision = 1) { @@ -2177,7 +2314,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * @param float|int|string|\DateInterval|null $precision * @param string $function * - * @return $this + * @return static */ public function round($precision = null, $function = 'round') { @@ -2192,7 +2329,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @param float|int|string|\DateInterval|null $precision * - * @return $this + * @return static */ public function floor($precision = null) { @@ -2204,7 +2341,7 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable * * @param float|int|string|\DateInterval|null $precision * - * @return $this + * @return static */ public function ceil($precision = null) { @@ -2393,9 +2530,9 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable protected function handleChangedParameters() { if (($this->getOptions() & static::IMMUTABLE) && $this->dateClass === Carbon::class) { - $this->setDateClass(CarbonImmutable::class); + $this->dateClass = CarbonImmutable::class; } elseif (!($this->getOptions() & static::IMMUTABLE) && $this->dateClass === CarbonImmutable::class) { - $this->setDateClass(Carbon::class); + $this->dateClass = Carbon::class; } $this->validationResult = null; @@ -2555,14 +2692,51 @@ class CarbonPeriod implements Iterator, Countable, JsonSerializable if (\is_string($value)) { $value = trim($value); - if (!preg_match('/^P[0-9T]/', $value) && - !preg_match('/^R[0-9]/', $value) && - preg_match('/[a-z0-9]/i', $value) + if (!preg_match('/^P[\dT]/', $value) && + !preg_match('/^R\d/', $value) && + preg_match('/[a-z\d]/i', $value) ) { - return Carbon::parse($value, $this->tzName); + $dateClass = $this->dateClass; + + return $dateClass::parse($value, $this->tzName); } } return null; } + + private function isInfiniteDate($date): bool + { + return $date instanceof CarbonInterface && ($date->isEndOfTime() || $date->isStartOfTime()); + } + + private function rawDate($date): ?DateTimeInterface + { + if ($date === false || $date === null) { + return null; + } + + if ($date instanceof CarbonInterface) { + return $date->isMutable() + ? $date->toDateTime() + : $date->toDateTimeImmutable(); + } + + if (\in_array(\get_class($date), [DateTime::class, DateTimeImmutable::class], true)) { + return $date; + } + + $class = $date instanceof DateTime ? DateTime::class : DateTimeImmutable::class; + + return new $class($date->format('Y-m-d H:i:s.u'), $date->getTimezone()); + } + + private static function setDefaultParameters(array &$parameters, array $defaults): void + { + foreach ($defaults as [$index, $name, $value]) { + if (!\array_key_exists($index, $parameters) && !\array_key_exists($name, $parameters)) { + $parameters[$index] = $value; + } + } + } } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/CarbonPeriodImmutable.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/CarbonPeriodImmutable.php new file mode 100644 index 000000000..f0d0ee281 --- /dev/null +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/CarbonPeriodImmutable.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon; + +class CarbonPeriodImmutable extends CarbonPeriod +{ + /** + * Default date class of iteration items. + * + * @var string + */ + protected const DEFAULT_DATE_CLASS = CarbonImmutable::class; + + /** + * Date class of iteration items. + * + * @var string + */ + protected $dateClass = CarbonImmutable::class; + + /** + * Prepare the instance to be set (self if mutable to be mutated, + * copy if immutable to generate a new instance). + * + * @return static + */ + protected function copyIfImmutable() + { + return $this->constructed ? clone $this : $this; + } +} diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/CarbonTimeZone.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/CarbonTimeZone.php index b4d16ba97..c81899f1e 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/CarbonTimeZone.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/CarbonTimeZone.php @@ -30,7 +30,7 @@ class CarbonTimeZone extends DateTimeZone throw new InvalidTimeZoneException('Absolute timezone offset cannot be greater than 100.'); } - return ($timezone >= 0 ? '+' : '').$timezone.':00'; + return ($timezone >= 0 ? '+' : '').ltrim($timezone, '+').':00'; } protected static function getDateTimeZoneNameFromMixed($timezone) @@ -101,15 +101,15 @@ class CarbonTimeZone extends DateTimeZone $tz = static::getDateTimeZoneFromName($object); } - if ($tz === false) { - if (Carbon::isStrictModeEnabled()) { - throw new InvalidTimeZoneException('Unknown or bad timezone ('.($objectDump ?: $object).')'); - } - - return false; + if ($tz !== false) { + return new static($tz->getName()); } - return new static($tz->getName()); + if (Carbon::isStrictModeEnabled()) { + throw new InvalidTimeZoneException('Unknown or bad timezone ('.($objectDump ?: $object).')'); + } + + return false; } /** @@ -231,15 +231,15 @@ class CarbonTimeZone extends DateTimeZone { $tz = $this->toRegionName($date); - if ($tz === false) { - if (Carbon::isStrictModeEnabled()) { - throw new InvalidTimeZoneException('Unknown timezone for offset '.$this->getOffset($date ?: Carbon::now($this)).' seconds.'); - } - - return false; + if ($tz !== false) { + return new static($tz); } - return new static($tz); + if (Carbon::isStrictModeEnabled()) { + throw new InvalidTimeZoneException('Unknown timezone for offset '.$this->getOffset($date ?: Carbon::now($this)).' seconds.'); + } + + return false; } /** @@ -252,6 +252,18 @@ class CarbonTimeZone extends DateTimeZone return $this->getName(); } + /** + * Return the type number: + * + * Type 1; A UTC offset, such as -0300 + * Type 2; A timezone abbreviation, such as GMT + * Type 3: A timezone identifier, such as Europe/London + */ + public function getType(): int + { + return preg_match('/"timezone_type";i:(\d)/', serialize($this), $match) ? (int) $match[1] : 3; + } + /** * Create a CarbonTimeZone from mixed input. * diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Doctrine/CarbonDoctrineType.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Doctrine/CarbonDoctrineType.php deleted file mode 100644 index ccc457fcd..000000000 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Doctrine/CarbonDoctrineType.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Carbon\Doctrine; - -use Doctrine\DBAL\Platforms\AbstractPlatform; - -interface CarbonDoctrineType -{ - public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform); - - public function convertToPHPValue($value, AbstractPlatform $platform); - - public function convertToDatabaseValue($value, AbstractPlatform $platform); -} diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Doctrine/CarbonImmutableType.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Doctrine/CarbonImmutableType.php deleted file mode 100644 index bf476a77e..000000000 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Doctrine/CarbonImmutableType.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Carbon\Doctrine; - -use Doctrine\DBAL\Platforms\AbstractPlatform; - -class CarbonImmutableType extends DateTimeImmutableType implements CarbonDoctrineType -{ - /** - * {@inheritdoc} - * - * @return string - */ - public function getName() - { - return 'carbon_immutable'; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function requiresSQLCommentHint(AbstractPlatform $platform) - { - return true; - } -} diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Doctrine/CarbonType.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Doctrine/CarbonType.php deleted file mode 100644 index 9289d84d3..000000000 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Doctrine/CarbonType.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Carbon\Doctrine; - -use Doctrine\DBAL\Platforms\AbstractPlatform; - -class CarbonType extends DateTimeType implements CarbonDoctrineType -{ - /** - * {@inheritdoc} - * - * @return string - */ - public function getName() - { - return 'carbon'; - } - - /** - * {@inheritdoc} - * - * @return bool - */ - public function requiresSQLCommentHint(AbstractPlatform $platform) - { - return true; - } -} diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Doctrine/DateTimeType.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Doctrine/DateTimeType.php deleted file mode 100644 index 29b0bb955..000000000 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Doctrine/DateTimeType.php +++ /dev/null @@ -1,16 +0,0 @@ - */ - use CarbonTypeConverter; -} diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/BadComparisonUnitException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/BadComparisonUnitException.php index b3a087190..3ca8837d1 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/BadComparisonUnitException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/BadComparisonUnitException.php @@ -11,19 +11,38 @@ namespace Carbon\Exceptions; -use Exception; +use Throwable; class BadComparisonUnitException extends UnitException { + /** + * The unit. + * + * @var string + */ + protected $unit; + /** * Constructor. * * @param string $unit * @param int $code - * @param Exception|null $previous + * @param Throwable|null $previous */ - public function __construct($unit, $code = 0, Exception $previous = null) + public function __construct($unit, $code = 0, Throwable $previous = null) { + $this->unit = $unit; + parent::__construct("Bad comparison unit: '$unit'", $code, $previous); } + + /** + * Get the unit. + * + * @return string + */ + public function getUnit(): string + { + return $this->unit; + } } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/BadFluentConstructorException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/BadFluentConstructorException.php index d5cd5564c..2e222e54e 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/BadFluentConstructorException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/BadFluentConstructorException.php @@ -12,19 +12,38 @@ namespace Carbon\Exceptions; use BadMethodCallException as BaseBadMethodCallException; -use Exception; +use Throwable; class BadFluentConstructorException extends BaseBadMethodCallException implements BadMethodCallException { + /** + * The method. + * + * @var string + */ + protected $method; + /** * Constructor. * * @param string $method * @param int $code - * @param Exception|null $previous + * @param Throwable|null $previous */ - public function __construct($method, $code = 0, Exception $previous = null) + public function __construct($method, $code = 0, Throwable $previous = null) { + $this->method = $method; + parent::__construct(sprintf("Unknown fluent constructor '%s'.", $method), $code, $previous); } + + /** + * Get the method. + * + * @return string + */ + public function getMethod(): string + { + return $this->method; + } } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/BadFluentSetterException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/BadFluentSetterException.php index 1d7ec542a..4ceaa2ef0 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/BadFluentSetterException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/BadFluentSetterException.php @@ -12,19 +12,38 @@ namespace Carbon\Exceptions; use BadMethodCallException as BaseBadMethodCallException; -use Exception; +use Throwable; class BadFluentSetterException extends BaseBadMethodCallException implements BadMethodCallException { + /** + * The setter. + * + * @var string + */ + protected $setter; + /** * Constructor. * - * @param string $method + * @param string $setter * @param int $code - * @param Exception|null $previous + * @param Throwable|null $previous */ - public function __construct($method, $code = 0, Exception $previous = null) + public function __construct($setter, $code = 0, Throwable $previous = null) { - parent::__construct(sprintf("Unknown fluent setter '%s'", $method), $code, $previous); + $this->setter = $setter; + + parent::__construct(sprintf("Unknown fluent setter '%s'", $setter), $code, $previous); + } + + /** + * Get the setter. + * + * @return string + */ + public function getSetter(): string + { + return $this->setter; } } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/BadMethodCallException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/BadMethodCallException.php index 73c2dd86f..108206d3e 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/BadMethodCallException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/BadMethodCallException.php @@ -13,4 +13,5 @@ namespace Carbon\Exceptions; interface BadMethodCallException extends Exception { + // } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/EndLessPeriodException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/EndLessPeriodException.php new file mode 100644 index 000000000..e10492693 --- /dev/null +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/EndLessPeriodException.php @@ -0,0 +1,19 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Exceptions; + +use RuntimeException as BaseRuntimeException; + +final class EndLessPeriodException extends BaseRuntimeException implements RuntimeException +{ + // +} diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/Exception.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/Exception.php index 3bbbd77d5..8ad747e75 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/Exception.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/Exception.php @@ -13,4 +13,5 @@ namespace Carbon\Exceptions; interface Exception { + // } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/ImmutableException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/ImmutableException.php index a48d4f936..db334c6c9 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/ImmutableException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/ImmutableException.php @@ -11,20 +11,38 @@ namespace Carbon\Exceptions; -use Exception; use RuntimeException as BaseRuntimeException; +use Throwable; class ImmutableException extends BaseRuntimeException implements RuntimeException { + /** + * The value. + * + * @var string + */ + protected $value; + /** * Constructor. * * @param string $value the immutable type/value * @param int $code - * @param Exception|null $previous + * @param Throwable|null $previous */ - public function __construct($value, $code = 0, Exception $previous = null) + public function __construct($value, $code = 0, Throwable $previous = null) { + $this->value = $value; parent::__construct("$value is immutable.", $code, $previous); } + + /** + * Get the value. + * + * @return string + */ + public function getValue(): string + { + return $this->value; + } } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidArgumentException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidArgumentException.php index 9739f4d18..5b013cd50 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidArgumentException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidArgumentException.php @@ -13,4 +13,5 @@ namespace Carbon\Exceptions; interface InvalidArgumentException extends Exception { + // } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidCastException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidCastException.php index d2f370199..a421401f6 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidCastException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidCastException.php @@ -11,20 +11,9 @@ namespace Carbon\Exceptions; -use Exception; use InvalidArgumentException as BaseInvalidArgumentException; class InvalidCastException extends BaseInvalidArgumentException implements InvalidArgumentException { - /** - * Constructor. - * - * @param string $message - * @param int $code - * @param Exception|null $previous - */ - public function __construct($message, $code = 0, Exception $previous = null) - { - parent::__construct($message, $code, $previous); - } + // } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php index 99bb91c05..c9ecb6b06 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php @@ -11,8 +11,8 @@ namespace Carbon\Exceptions; -use Exception; use InvalidArgumentException as BaseInvalidArgumentException; +use Throwable; class InvalidDateException extends BaseInvalidArgumentException implements InvalidArgumentException { @@ -36,9 +36,9 @@ class InvalidDateException extends BaseInvalidArgumentException implements Inval * @param string $field * @param mixed $value * @param int $code - * @param Exception|null $previous + * @param Throwable|null $previous */ - public function __construct($field, $value, $code = 0, Exception $previous = null) + public function __construct($field, $value, $code = 0, Throwable $previous = null) { $this->field = $field; $this->value = $value; diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidFormatException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidFormatException.php index 3341b49d0..92d55fe35 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidFormatException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidFormatException.php @@ -11,20 +11,9 @@ namespace Carbon\Exceptions; -use Exception; use InvalidArgumentException as BaseInvalidArgumentException; class InvalidFormatException extends BaseInvalidArgumentException implements InvalidArgumentException { - /** - * Constructor. - * - * @param string $message - * @param int $code - * @param Exception|null $previous - */ - public function __construct($message, $code = 0, Exception $previous = null) - { - parent::__construct($message, $code, $previous); - } + // } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidIntervalException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidIntervalException.php index 5f9f142ee..69cf4128a 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidIntervalException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidIntervalException.php @@ -11,20 +11,9 @@ namespace Carbon\Exceptions; -use Exception; use InvalidArgumentException as BaseInvalidArgumentException; class InvalidIntervalException extends BaseInvalidArgumentException implements InvalidArgumentException { - /** - * Constructor. - * - * @param string $message - * @param int $code - * @param Exception|null $previous - */ - public function __construct($message, $code = 0, Exception $previous = null) - { - parent::__construct($message, $code, $previous); - } + // } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidPeriodDateException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidPeriodDateException.php index a37e3f5ec..9bd84a96d 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidPeriodDateException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidPeriodDateException.php @@ -11,20 +11,9 @@ namespace Carbon\Exceptions; -use Exception; use InvalidArgumentException as BaseInvalidArgumentException; class InvalidPeriodDateException extends BaseInvalidArgumentException implements InvalidArgumentException { - /** - * Constructor. - * - * @param string $message - * @param int $code - * @param Exception|null $previous - */ - public function __construct($message, $code = 0, Exception $previous = null) - { - parent::__construct($message, $code, $previous); - } + // } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidPeriodParameterException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidPeriodParameterException.php index ede47712b..cf2c90240 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidPeriodParameterException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidPeriodParameterException.php @@ -11,20 +11,9 @@ namespace Carbon\Exceptions; -use Exception; use InvalidArgumentException as BaseInvalidArgumentException; class InvalidPeriodParameterException extends BaseInvalidArgumentException implements InvalidArgumentException { - /** - * Constructor. - * - * @param string $message - * @param int $code - * @param Exception|null $previous - */ - public function __construct($message, $code = 0, Exception $previous = null) - { - parent::__construct($message, $code, $previous); - } + // } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidTimeZoneException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidTimeZoneException.php index 892e16e81..f72595583 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidTimeZoneException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidTimeZoneException.php @@ -11,20 +11,9 @@ namespace Carbon\Exceptions; -use Exception; use InvalidArgumentException as BaseInvalidArgumentException; class InvalidTimeZoneException extends BaseInvalidArgumentException implements InvalidArgumentException { - /** - * Constructor. - * - * @param string $message - * @param int $code - * @param Exception|null $previous - */ - public function __construct($message, $code = 0, Exception $previous = null) - { - parent::__construct($message, $code, $previous); - } + // } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidTypeException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidTypeException.php index 3fbe3fc47..2c8ec9ba0 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidTypeException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/InvalidTypeException.php @@ -11,20 +11,9 @@ namespace Carbon\Exceptions; -use Exception; use InvalidArgumentException as BaseInvalidArgumentException; class InvalidTypeException extends BaseInvalidArgumentException implements InvalidArgumentException { - /** - * Constructor. - * - * @param string $message - * @param int $code - * @param Exception|null $previous - */ - public function __construct($message, $code = 0, Exception $previous = null) - { - parent::__construct($message, $code, $previous); - } + // } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/NotACarbonClassException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/NotACarbonClassException.php index 2b4c48e32..7a87632c4 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/NotACarbonClassException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/NotACarbonClassException.php @@ -12,24 +12,39 @@ namespace Carbon\Exceptions; use Carbon\CarbonInterface; -use Exception; use InvalidArgumentException as BaseInvalidArgumentException; +use Throwable; class NotACarbonClassException extends BaseInvalidArgumentException implements InvalidArgumentException { + /** + * The className. + * + * @var string + */ + protected $className; + /** * Constructor. * * @param string $className * @param int $code - * @param Exception|null $previous + * @param Throwable|null $previous */ - public function __construct($className, $code = 0, Exception $previous = null) + public function __construct($className, $code = 0, Throwable $previous = null) { - parent::__construct(sprintf( - 'Given class does not implement %s: %s', - CarbonInterface::class, - $className - ), $code, $previous); + $this->className = $className; + + parent::__construct(sprintf('Given class does not implement %s: %s', CarbonInterface::class, $className), $code, $previous); + } + + /** + * Get the className. + * + * @return string + */ + public function getClassName(): string + { + return $this->className; } } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/NotAPeriodException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/NotAPeriodException.php index 41bb62902..4edd7a484 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/NotAPeriodException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/NotAPeriodException.php @@ -11,20 +11,9 @@ namespace Carbon\Exceptions; -use Exception; use InvalidArgumentException as BaseInvalidArgumentException; class NotAPeriodException extends BaseInvalidArgumentException implements InvalidArgumentException { - /** - * Constructor. - * - * @param string $message - * @param int $code - * @param Exception|null $previous - */ - public function __construct($message, $code = 0, Exception $previous = null) - { - parent::__construct($message, $code, $previous); - } + // } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/NotLocaleAwareException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/NotLocaleAwareException.php index adbc36cd5..f2c546843 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/NotLocaleAwareException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/NotLocaleAwareException.php @@ -11,8 +11,8 @@ namespace Carbon\Exceptions; -use Exception; use InvalidArgumentException as BaseInvalidArgumentException; +use Throwable; class NotLocaleAwareException extends BaseInvalidArgumentException implements InvalidArgumentException { @@ -21,9 +21,9 @@ class NotLocaleAwareException extends BaseInvalidArgumentException implements In * * @param mixed $object * @param int $code - * @param Exception|null $previous + * @param Throwable|null $previous */ - public function __construct($object, $code = 0, Exception $previous = null) + public function __construct($object, $code = 0, Throwable $previous = null) { $dump = \is_object($object) ? \get_class($object) : \gettype($object); diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/OutOfRangeException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/OutOfRangeException.php index 54822d954..2c586d0b7 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/OutOfRangeException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/OutOfRangeException.php @@ -11,8 +11,8 @@ namespace Carbon\Exceptions; -use Exception; use InvalidArgumentException as BaseInvalidArgumentException; +use Throwable; // This will extends OutOfRangeException instead of InvalidArgumentException since 3.0.0 // use OutOfRangeException as BaseOutOfRangeException; @@ -55,9 +55,9 @@ class OutOfRangeException extends BaseInvalidArgumentException implements Invali * @param mixed $max * @param mixed $value * @param int $code - * @param Exception|null $previous + * @param Throwable|null $previous */ - public function __construct($unit, $min, $max, $value, $code = 0, Exception $previous = null) + public function __construct($unit, $min, $max, $value, $code = 0, Throwable $previous = null) { $this->unit = $unit; $this->min = $min; diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/ParseErrorException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/ParseErrorException.php index 0314c5d88..5416fd149 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/ParseErrorException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/ParseErrorException.php @@ -11,23 +11,78 @@ namespace Carbon\Exceptions; -use Exception; use InvalidArgumentException as BaseInvalidArgumentException; +use Throwable; class ParseErrorException extends BaseInvalidArgumentException implements InvalidArgumentException { + /** + * The expected. + * + * @var string + */ + protected $expected; + + /** + * The actual. + * + * @var string + */ + protected $actual; + + /** + * The help message. + * + * @var string + */ + protected $help; + /** * Constructor. * * @param string $expected * @param string $actual * @param int $code - * @param Exception|null $previous + * @param Throwable|null $previous */ - public function __construct($expected, $actual, $help = '', $code = 0, Exception $previous = null) + public function __construct($expected, $actual, $help = '', $code = 0, Throwable $previous = null) { + $this->expected = $expected; + $this->actual = $actual; + $this->help = $help; + $actual = $actual === '' ? 'data is missing' : "get '$actual'"; parent::__construct(trim("Format expected $expected but $actual\n$help"), $code, $previous); } + + /** + * Get the expected. + * + * @return string + */ + public function getExpected(): string + { + return $this->expected; + } + + /** + * Get the actual. + * + * @return string + */ + public function getActual(): string + { + return $this->actual; + } + + /** + * Get the help message. + * + * @return string + */ + public function getHelp(): string + { + return $this->help; + } } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/RuntimeException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/RuntimeException.php index 24bf5a68b..ad196f79d 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/RuntimeException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/RuntimeException.php @@ -13,4 +13,5 @@ namespace Carbon\Exceptions; interface RuntimeException extends Exception { + // } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnitException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnitException.php index 8bd8653e1..ee99953b4 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnitException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnitException.php @@ -11,20 +11,9 @@ namespace Carbon\Exceptions; -use Exception; use InvalidArgumentException as BaseInvalidArgumentException; class UnitException extends BaseInvalidArgumentException implements InvalidArgumentException { - /** - * Constructor. - * - * @param string $message - * @param int $code - * @param Exception|null $previous - */ - public function __construct($message, $code = 0, Exception $previous = null) - { - parent::__construct($message, $code, $previous); - } + // } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnitNotConfiguredException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnitNotConfiguredException.php index 39ee12c5b..0e7230563 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnitNotConfiguredException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnitNotConfiguredException.php @@ -11,19 +11,38 @@ namespace Carbon\Exceptions; -use Exception; +use Throwable; class UnitNotConfiguredException extends UnitException { + /** + * The unit. + * + * @var string + */ + protected $unit; + /** * Constructor. * * @param string $unit * @param int $code - * @param Exception|null $previous + * @param Throwable|null $previous */ - public function __construct($unit, $code = 0, Exception $previous = null) + public function __construct($unit, $code = 0, Throwable $previous = null) { + $this->unit = $unit; + parent::__construct("Unit $unit have no configuration to get total from other units.", $code, $previous); } + + /** + * Get the unit. + * + * @return string + */ + public function getUnit(): string + { + return $this->unit; + } } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownGetterException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownGetterException.php index 6c8c01b6c..5c504975a 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownGetterException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownGetterException.php @@ -11,20 +11,39 @@ namespace Carbon\Exceptions; -use Exception; use InvalidArgumentException as BaseInvalidArgumentException; +use Throwable; class UnknownGetterException extends BaseInvalidArgumentException implements InvalidArgumentException { + /** + * The getter. + * + * @var string + */ + protected $getter; + /** * Constructor. * - * @param string $name getter name + * @param string $getter getter name * @param int $code - * @param Exception|null $previous + * @param Throwable|null $previous */ - public function __construct($name, $code = 0, Exception $previous = null) + public function __construct($getter, $code = 0, Throwable $previous = null) { - parent::__construct("Unknown getter '$name'", $code, $previous); + $this->getter = $getter; + + parent::__construct("Unknown getter '$getter'", $code, $previous); + } + + /** + * Get the getter. + * + * @return string + */ + public function getGetter(): string + { + return $this->getter; } } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownMethodException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownMethodException.php index 901db986a..75273a706 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownMethodException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownMethodException.php @@ -12,19 +12,38 @@ namespace Carbon\Exceptions; use BadMethodCallException as BaseBadMethodCallException; -use Exception; +use Throwable; class UnknownMethodException extends BaseBadMethodCallException implements BadMethodCallException { + /** + * The method. + * + * @var string + */ + protected $method; + /** * Constructor. * * @param string $method * @param int $code - * @param Exception|null $previous + * @param Throwable|null $previous */ - public function __construct($method, $code = 0, Exception $previous = null) + public function __construct($method, $code = 0, Throwable $previous = null) { + $this->method = $method; + parent::__construct("Method $method does not exist.", $code, $previous); } + + /** + * Get the method. + * + * @return string + */ + public function getMethod(): string + { + return $this->method; + } } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownSetterException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownSetterException.php index c9e9c9ff2..a795f5d72 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownSetterException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownSetterException.php @@ -11,20 +11,39 @@ namespace Carbon\Exceptions; -use Exception; use InvalidArgumentException as BaseInvalidArgumentException; +use Throwable; class UnknownSetterException extends BaseInvalidArgumentException implements BadMethodCallException { + /** + * The setter. + * + * @var string + */ + protected $setter; + /** * Constructor. * - * @param string $name setter name + * @param string $setter setter name * @param int $code - * @param Exception|null $previous + * @param Throwable|null $previous */ - public function __construct($name, $code = 0, Exception $previous = null) + public function __construct($setter, $code = 0, Throwable $previous = null) { - parent::__construct("Unknown setter '$name'", $code, $previous); + $this->setter = $setter; + + parent::__construct("Unknown setter '$setter'", $code, $previous); + } + + /** + * Get the setter. + * + * @return string + */ + public function getSetter(): string + { + return $this->setter; } } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownUnitException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownUnitException.php index d965c82ae..ecd7f7a59 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownUnitException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnknownUnitException.php @@ -11,19 +11,38 @@ namespace Carbon\Exceptions; -use Exception; +use Throwable; class UnknownUnitException extends UnitException { + /** + * The unit. + * + * @var string + */ + protected $unit; + /** * Constructor. * * @param string $unit * @param int $code - * @param Exception|null $previous + * @param Throwable|null $previous */ - public function __construct($unit, $code = 0, Exception $previous = null) + public function __construct($unit, $code = 0, Throwable $previous = null) { + $this->unit = $unit; + parent::__construct("Unknown unit '$unit'.", $code, $previous); } + + /** + * Get the unit. + * + * @return string + */ + public function getUnit(): string + { + return $this->unit; + } } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnreachableException.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnreachableException.php index 6f8b39f5f..1654ab11b 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnreachableException.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Exceptions/UnreachableException.php @@ -11,20 +11,9 @@ namespace Carbon\Exceptions; -use Exception; use RuntimeException as BaseRuntimeException; class UnreachableException extends BaseRuntimeException implements RuntimeException { - /** - * Constructor. - * - * @param string $message - * @param int $code - * @param Exception|null $previous - */ - public function __construct($message, $code = 0, Exception $previous = null) - { - parent::__construct($message, $code, $previous); - } + // } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Factory.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Factory.php index f8c72890c..d497535f7 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Factory.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Factory.php @@ -177,10 +177,10 @@ use ReflectionMethod; * parameter of null. * /!\ Use this method for unit tests only. * @method void setToStringFormat($format) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. - * You should rather let Carbon object being casted to string with DEFAULT_TO_STRING_FORMAT, and - * use other method or custom format passed to format() method if you need to dump an other string + * You should rather let Carbon object being cast to string with DEFAULT_TO_STRING_FORMAT, and + * use other method or custom format passed to format() method if you need to dump another string * format. - * Set the default format used when type juggling a Carbon instance to a string + * Set the default format used when type juggling a Carbon instance to a string. * @method void setTranslator(TranslatorInterface $translator) Set the default translator instance to use. * @method Carbon setUtf8($utf8) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. * You should rather use UTF-8 language packages on every machine. @@ -231,7 +231,7 @@ use ReflectionMethod; * You should rather use the ->settings() method. * Or you can use method variants: addYearsWithOverflow/addYearsNoOverflow, same variants * are available for quarters, years, decade, centuries, millennia (singular and plural forms). - * @method mixed withTestNow($testNow = null, $callback = null) Temporarily sets a static date to be used within the callback. + * @method mixed withTestNow($testNow, $callback) Temporarily sets a static date to be used within the callback. * Using setTestNow to set the date, executing the callback, then * clearing the test instance. * /!\ Use this method for unit tests only. diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/FactoryImmutable.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/FactoryImmutable.php index 596ee8064..d88a1cf67 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/FactoryImmutable.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/FactoryImmutable.php @@ -12,6 +12,9 @@ namespace Carbon; use Closure; +use DateTimeImmutable; +use DateTimeZone; +use Psr\Clock\ClockInterface; /** * A factory to generate CarbonImmutable instances with common settings. @@ -111,7 +114,6 @@ use Closure; * @method CarbonImmutable maxValue() Create a Carbon instance for the greatest supported date. * @method CarbonImmutable minValue() Create a Carbon instance for the lowest supported date. * @method void mixin($mixin) Mix another object into the class. - * @method CarbonImmutable now($tz = null) Get a Carbon instance for the current date and time. * @method CarbonImmutable parse($time = null, $tz = null) Create a carbon instance from a string. * This is an alias for the constructor that allows better fluent syntax * as it allows you to do Carbon::parse('Monday next week')->fn() rather @@ -175,10 +177,10 @@ use Closure; * parameter of null. * /!\ Use this method for unit tests only. * @method void setToStringFormat($format) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. - * You should rather let Carbon object being casted to string with DEFAULT_TO_STRING_FORMAT, and - * use other method or custom format passed to format() method if you need to dump an other string + * You should rather let Carbon object being cast to string with DEFAULT_TO_STRING_FORMAT, and + * use other method or custom format passed to format() method if you need to dump another string * format. - * Set the default format used when type juggling a Carbon instance to a string + * Set the default format used when type juggling a Carbon instance to a string. * @method void setTranslator(TranslatorInterface $translator) Set the default translator instance to use. * @method CarbonImmutable setUtf8($utf8) @deprecated To avoid conflict between different third-party libraries, static setters should not be used. * You should rather use UTF-8 language packages on every machine. @@ -229,7 +231,7 @@ use Closure; * You should rather use the ->settings() method. * Or you can use method variants: addYearsWithOverflow/addYearsNoOverflow, same variants * are available for quarters, years, decade, centuries, millennia (singular and plural forms). - * @method mixed withTestNow($testNow = null, $callback = null) Temporarily sets a static date to be used within the callback. + * @method mixed withTestNow($testNow, $callback) Temporarily sets a static date to be used within the callback. * Using setTestNow to set the date, executing the callback, then * clearing the test instance. * /!\ Use this method for unit tests only. @@ -237,7 +239,21 @@ use Closure; * * */ -class FactoryImmutable extends Factory +class FactoryImmutable extends Factory implements ClockInterface { protected $className = CarbonImmutable::class; + + /** + * Get a Carbon instance for the current date and time. + * + * @param DateTimeZone|string|int|null $tz + * + * @return CarbonImmutable + */ + public function now($tz = null): DateTimeImmutable + { + $className = $this->className; + + return new $className(null, $tz); + } } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_AE.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_AE.php index 75fe47f6d..35a22b1d2 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_AE.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_AE.php @@ -12,6 +12,7 @@ /* * Authors: * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri */ return array_replace_recursive(require __DIR__.'/ar.php', [ 'formats' => [ @@ -24,4 +25,5 @@ return array_replace_recursive(require __DIR__.'/ar.php', [ 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'first_day_of_week' => 6, 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]); diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_BH.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_BH.php index 362009e29..35180965a 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_BH.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_BH.php @@ -12,6 +12,7 @@ /* * Authors: * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri */ return array_replace_recursive(require __DIR__.'/ar.php', [ 'formats' => [ @@ -24,4 +25,5 @@ return array_replace_recursive(require __DIR__.'/ar.php', [ 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'first_day_of_week' => 6, 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]); diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_EG.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_EG.php index 362009e29..35180965a 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_EG.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_EG.php @@ -12,6 +12,7 @@ /* * Authors: * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri */ return array_replace_recursive(require __DIR__.'/ar.php', [ 'formats' => [ @@ -24,4 +25,5 @@ return array_replace_recursive(require __DIR__.'/ar.php', [ 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'first_day_of_week' => 6, 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]); diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_IQ.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_IQ.php index 0ac09958e..2d4200845 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_IQ.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_IQ.php @@ -12,6 +12,7 @@ /* * Authors: * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri */ return array_replace_recursive(require __DIR__.'/ar.php', [ 'formats' => [ @@ -24,4 +25,5 @@ return array_replace_recursive(require __DIR__.'/ar.php', [ 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'first_day_of_week' => 6, 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]); diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_JO.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_JO.php index 0ac09958e..2d4200845 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_JO.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_JO.php @@ -12,6 +12,7 @@ /* * Authors: * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri */ return array_replace_recursive(require __DIR__.'/ar.php', [ 'formats' => [ @@ -24,4 +25,5 @@ return array_replace_recursive(require __DIR__.'/ar.php', [ 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'first_day_of_week' => 6, 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]); diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_KW.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_KW.php index e6f0531d4..b3fb1cfec 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_KW.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_KW.php @@ -16,6 +16,7 @@ * - JD Isaacks * - Atef Ben Ali (atefBB) * - Mohamed Sabil (mohamedsabil83) + * - Abdullah-Alhariri */ $months = [ 'يناير', @@ -90,4 +91,5 @@ return [ ], 'meridiem' => ['ص', 'م'], 'weekend' => [5, 6], + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]; diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_LB.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_LB.php index 55bb10c33..2792745c6 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_LB.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_LB.php @@ -12,6 +12,7 @@ /* * Authors: * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri */ return array_replace_recursive(require __DIR__.'/ar.php', [ 'formats' => [ @@ -24,4 +25,5 @@ return array_replace_recursive(require __DIR__.'/ar.php', [ 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'first_day_of_week' => 1, 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]); diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_OM.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_OM.php index 362009e29..35180965a 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_OM.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_OM.php @@ -12,6 +12,7 @@ /* * Authors: * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri */ return array_replace_recursive(require __DIR__.'/ar.php', [ 'formats' => [ @@ -24,4 +25,5 @@ return array_replace_recursive(require __DIR__.'/ar.php', [ 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'first_day_of_week' => 6, 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]); diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_PS.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_PS.php index e790b99e6..503c60d2e 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_PS.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_PS.php @@ -9,5 +9,10 @@ * file that was distributed with this source code. */ +/* + * Authors: + * - Abdullah-Alhariri + */ return array_replace_recursive(require __DIR__.'/ar.php', [ + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]); diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_QA.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_QA.php index 362009e29..35180965a 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_QA.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_QA.php @@ -12,6 +12,7 @@ /* * Authors: * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri */ return array_replace_recursive(require __DIR__.'/ar.php', [ 'formats' => [ @@ -24,4 +25,5 @@ return array_replace_recursive(require __DIR__.'/ar.php', [ 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'first_day_of_week' => 6, 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]); diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_SA.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_SA.php index 10aaa2ede..550b0c73a 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_SA.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_SA.php @@ -15,6 +15,7 @@ * - JD Isaacks * - Atef Ben Ali (atefBB) * - Mohamed Sabil (mohamedsabil83) + * - Abdullah-Alhariri */ $months = [ 'يناير', @@ -89,4 +90,5 @@ return [ ], 'meridiem' => ['ص', 'م'], 'weekend' => [5, 6], + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]; diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_SD.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_SD.php index 362009e29..35180965a 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_SD.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_SD.php @@ -12,6 +12,7 @@ /* * Authors: * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri */ return array_replace_recursive(require __DIR__.'/ar.php', [ 'formats' => [ @@ -24,4 +25,5 @@ return array_replace_recursive(require __DIR__.'/ar.php', [ 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'first_day_of_week' => 6, 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]); diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_SY.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_SY.php index 0ac09958e..2d4200845 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_SY.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_SY.php @@ -12,6 +12,7 @@ /* * Authors: * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri */ return array_replace_recursive(require __DIR__.'/ar.php', [ 'formats' => [ @@ -24,4 +25,5 @@ return array_replace_recursive(require __DIR__.'/ar.php', [ 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'first_day_of_week' => 6, 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]); diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_YE.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_YE.php index 5dc29388e..169fe88a9 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_YE.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ar_YE.php @@ -12,6 +12,7 @@ /* * Authors: * - IBM Globalization Center of Competency, Yamato Software Laboratory bug-glibc-locales@gnu.org + * - Abdullah-Alhariri */ return array_replace_recursive(require __DIR__.'/ar.php', [ 'formats' => [ @@ -23,4 +24,5 @@ return array_replace_recursive(require __DIR__.'/ar.php', [ 'weekdays_short' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'weekdays_min' => ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س'], 'day_of_first_week_of_year' => 1, + 'alt_numbers' => ['۰۰', '۰۱', '۰۲', '۰۳', '۰٤', '۰٥', '۰٦', '۰۷', '۰۸', '۰۹', '۱۰', '۱۱', '۱۲', '۱۳', '۱٤', '۱٥', '۱٦', '۱۷', '۱۸', '۱۹', '۲۰', '۲۱', '۲۲', '۲۳', '۲٤', '۲٥', '۲٦', '۲۷', '۲۸', '۲۹', '۳۰', '۳۱', '۳۲', '۳۳', '۳٤', '۳٥', '۳٦', '۳۷', '۳۸', '۳۹', '٤۰', '٤۱', '٤۲', '٤۳', '٤٤', '٤٥', '٤٦', '٤۷', '٤۸', '٤۹', '٥۰', '٥۱', '٥۲', '٥۳', '٥٤', '٥٥', '٥٦', '٥۷', '٥۸', '٥۹', '٦۰', '٦۱', '٦۲', '٦۳', '٦٤', '٦٥', '٦٦', '٦۷', '٦۸', '٦۹', '۷۰', '۷۱', '۷۲', '۷۳', '۷٤', '۷٥', '۷٦', '۷۷', '۷۸', '۷۹', '۸۰', '۸۱', '۸۲', '۸۳', '۸٤', '۸٥', '۸٦', '۸۷', '۸۸', '۸۹', '۹۰', '۹۱', '۹۲', '۹۳', '۹٤', '۹٥', '۹٦', '۹۷', '۹۸', '۹۹'], ]); diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/be.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/be.php index 51b4d0cc1..ee736365a 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/be.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/be.php @@ -9,13 +9,12 @@ * file that was distributed with this source code. */ -// @codeCoverageIgnoreStart - use Carbon\CarbonInterface; use Symfony\Component\Translation\PluralizationRules; -if (class_exists('Symfony\\Component\\Translation\\PluralizationRules')) { - PluralizationRules::set(function ($number) { +// @codeCoverageIgnoreStart +if (class_exists(PluralizationRules::class)) { + PluralizationRules::set(static function ($number) { return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); }, 'be'); } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ca_ES_Valencia.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ca_ES_Valencia.php index 861acd2a0..1c16421ad 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ca_ES_Valencia.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ca_ES_Valencia.php @@ -9,5 +9,15 @@ * file that was distributed with this source code. */ +use Symfony\Component\Translation\PluralizationRules; + +// @codeCoverageIgnoreStart +if (class_exists(PluralizationRules::class)) { + PluralizationRules::set(static function ($number) { + return PluralizationRules::get($number, 'ca'); + }, 'ca_ES_Valencia'); +} +// @codeCoverageIgnoreEnd + return array_replace_recursive(require __DIR__.'/ca.php', [ ]); diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ckb.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ckb.php new file mode 100644 index 000000000..acf4dc280 --- /dev/null +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ckb.php @@ -0,0 +1,89 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/* + * Authors: + * - Swara Mohammed + */ +$months = [ + 'ڕێبەندان', + 'ڕەشەمە', + 'نەورۆز', + 'گوڵان', + 'جۆزەردان', + 'پوشپەڕ', + 'گەلاوێژ', + 'خەرمانان', + 'ڕەزبەر', + 'گەڵاڕێزان', + 'سەرماوەرز', + 'بەفرانبار', +]; + +return [ + 'year' => implode('|', ['{0}:count ساڵێک', '{1}ساڵێک', '{2}دوو ساڵ', ']2,11[:count ساڵ', ']10,Inf[:count ساڵ']), + 'a_year' => implode('|', ['{0}:count ساڵێک', '{1}ساڵێک', '{2}دوو ساڵ', ']2,11[:count ساڵ', ']10,Inf[:count ساڵ']), + 'month' => implode('|', ['{0}:count مانگێک', '{1}مانگێک', '{2}دوو مانگ', ']2,11[:count مانگ', ']10,Inf[:count مانگ']), + 'a_month' => implode('|', ['{0}:count مانگێک', '{1}مانگێک', '{2}دوو مانگ', ']2,11[:count مانگ', ']10,Inf[:count مانگ']), + 'week' => implode('|', ['{0}:count هەفتەیەک', '{1}هەفتەیەک', '{2}دوو هەفتە', ']2,11[:count هەفتە', ']10,Inf[:count هەفتە']), + 'a_week' => implode('|', ['{0}:count هەفتەیەک', '{1}هەفتەیەک', '{2}دوو هەفتە', ']2,11[:count هەفتە', ']10,Inf[:count هەفتە']), + 'day' => implode('|', ['{0}:count ڕۆژێک', '{1}ڕۆژێک', '{2}دوو ڕۆژ', ']2,11[:count ڕۆژ', ']10,Inf[:count ڕۆژ']), + 'a_day' => implode('|', ['{0}:count ڕۆژێک', '{1}ڕۆژێک', '{2}دوو ڕۆژ', ']2,11[:count ڕۆژ', ']10,Inf[:count ڕۆژ']), + 'hour' => implode('|', ['{0}:count کاتژمێرێک', '{1}کاتژمێرێک', '{2}دوو کاتژمێر', ']2,11[:count کاتژمێر', ']10,Inf[:count کاتژمێر']), + 'a_hour' => implode('|', ['{0}:count کاتژمێرێک', '{1}کاتژمێرێک', '{2}دوو کاتژمێر', ']2,11[:count کاتژمێر', ']10,Inf[:count کاتژمێر']), + 'minute' => implode('|', ['{0}:count خولەکێک', '{1}خولەکێک', '{2}دوو خولەک', ']2,11[:count خولەک', ']10,Inf[:count خولەک']), + 'a_minute' => implode('|', ['{0}:count خولەکێک', '{1}خولەکێک', '{2}دوو خولەک', ']2,11[:count خولەک', ']10,Inf[:count خولەک']), + 'second' => implode('|', ['{0}:count چرکەیەک', '{1}چرکەیەک', '{2}دوو چرکە', ']2,11[:count چرکە', ']10,Inf[:count چرکە']), + 'a_second' => implode('|', ['{0}:count چرکەیەک', '{1}چرکەیەک', '{2}دوو چرکە', ']2,11[:count چرکە', ']10,Inf[:count چرکە']), + 'ago' => 'پێش :time', + 'from_now' => ':time لە ئێستاوە', + 'after' => 'دوای :time', + 'before' => 'پێش :time', + 'diff_now' => 'ئێستا', + 'diff_today' => 'ئەمڕۆ', + 'diff_today_regexp' => 'ڕۆژ(?:\\s+لە)?(?:\\s+کاتژمێر)?', + 'diff_yesterday' => 'دوێنێ', + 'diff_yesterday_regexp' => 'دوێنێ(?:\\s+لە)?(?:\\s+کاتژمێر)?', + 'diff_tomorrow' => 'سبەینێ', + 'diff_tomorrow_regexp' => 'سبەینێ(?:\\s+لە)?(?:\\s+کاتژمێر)?', + 'diff_before_yesterday' => 'پێش دوێنێ', + 'diff_after_tomorrow' => 'دوای سبەینێ', + 'period_recurrences' => implode('|', ['{0}جار', '{1}جار', '{2}:count دووجار', ']2,11[:count جار', ']10,Inf[:count جار']), + 'period_interval' => 'هەموو :interval', + 'period_start_date' => 'لە :date', + 'period_end_date' => 'بۆ :date', + 'months' => $months, + 'months_short' => $months, + 'weekdays' => ['یەکشەممە', 'دووشەممە', 'سێشەممە', 'چوارشەممە', 'پێنجشەممە', 'هەینی', 'شەممە'], + 'weekdays_short' => ['یەکشەممە', 'دووشەممە', 'سێشەممە', 'چوارشەممە', 'پێنجشەممە', 'هەینی', 'شەممە'], + 'weekdays_min' => ['یەکشەممە', 'دووشەممە', 'سێشەممە', 'چوارشەممە', 'پێنجشەممە', 'هەینی', 'شەممە'], + 'list' => ['، ', ' و '], + 'first_day_of_week' => 6, + 'day_of_first_week_of_year' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'D/M/YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], + 'calendar' => [ + 'sameDay' => '[ئەمڕۆ لە کاتژمێر] LT', + 'nextDay' => '[سبەینێ لە کاتژمێر] LT', + 'nextWeek' => 'dddd [لە کاتژمێر] LT', + 'lastDay' => '[دوێنێ لە کاتژمێر] LT', + 'lastWeek' => 'dddd [لە کاتژمێر] LT', + 'sameElse' => 'L', + ], + 'meridiem' => ['پ.ن', 'د.ن'], + 'weekend' => [5, 6], +]; diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/cs.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/cs.php index 8cff9a019..c01e3ccc8 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/cs.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/cs.php @@ -101,7 +101,8 @@ return [ 'after' => $za, 'first_day_of_week' => 1, 'day_of_first_week_of_year' => 4, - 'months' => ['leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec'], + 'months' => ['ledna', 'února', 'března', 'dubna', 'května', 'června', 'července', 'srpna', 'září', 'října', 'listopadu', 'prosince'], + 'months_standalone' => ['leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec'], 'months_short' => ['led', 'úno', 'bře', 'dub', 'kvě', 'čvn', 'čvc', 'srp', 'zář', 'říj', 'lis', 'pro'], 'weekdays' => ['neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota'], 'weekdays_short' => ['ned', 'pon', 'úte', 'stř', 'čtv', 'pát', 'sob'], diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/cy.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/cy.php index ab7c45a4f..119274f01 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/cy.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/cy.php @@ -60,7 +60,7 @@ return [ 'ordinal' => function ($number) { return $number.( $number > 20 - ? (\in_array($number, [40, 50, 60, 80, 100]) ? 'fed' : 'ain') + ? (\in_array((int) $number, [40, 50, 60, 80, 100], true) ? 'fed' : 'ain') : ([ '', 'af', 'il', 'ydd', 'ydd', 'ed', 'ed', 'ed', 'fed', 'fed', 'fed', // 1af to 10fed 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'fed', // 11eg to 20fed diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/da.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/da.php index 4e6640a67..322f91d5b 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/da.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/da.php @@ -18,6 +18,7 @@ * - Jens Herlevsen * - Ulrik McArdle (mcardle) * - Frederik Sauer (FrittenKeeZ) + * - Janus Bahs Jacquet (kokoshneta) */ return [ 'year' => ':count år|:count år', @@ -41,7 +42,7 @@ return [ 'second' => ':count sekund|:count sekunder', 'a_second' => 'få sekunder|:count sekunder', 's' => ':count s.', - 'ago' => ':time siden', + 'ago' => 'for :time siden', 'from_now' => 'om :time', 'after' => ':time efter', 'before' => ':time før', @@ -70,9 +71,9 @@ return [ ], 'ordinal' => ':number.', 'months' => ['januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'], - 'months_short' => ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'], + 'months_short' => ['jan.', 'feb.', 'mar.', 'apr.', 'maj.', 'jun.', 'jul.', 'aug.', 'sep.', 'okt.', 'nov.', 'dec.'], 'weekdays' => ['søndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'lørdag'], - 'weekdays_short' => ['søn', 'man', 'tir', 'ons', 'tor', 'fre', 'lør'], + 'weekdays_short' => ['søn.', 'man.', 'tir.', 'ons.', 'tor.', 'fre.', 'lør.'], 'weekdays_min' => ['sø', 'ma', 'ti', 'on', 'to', 'fr', 'lø'], 'first_day_of_week' => 1, 'day_of_first_week_of_year' => 4, diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/de.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/de.php index ff00c9745..3b70750e4 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/de.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/de.php @@ -105,4 +105,13 @@ return [ 'first_day_of_week' => 1, 'day_of_first_week_of_year' => 4, 'list' => [', ', ' und '], + 'ordinal_words' => [ + 'of' => 'im', + 'first' => 'erster', + 'second' => 'zweiter', + 'third' => 'dritter', + 'fourth' => 'vierten', + 'fifth' => 'fünfter', + 'last' => 'letzten', + ], ]; diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/en.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/en.php index a8633fef0..f81f617e3 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/en.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/en.php @@ -72,7 +72,7 @@ return [ $lastDigit = $number % 10; return $number.( - (~~($number % 100 / 10) === 1) ? 'th' : ( + ((int) ($number % 100 / 10) === 1) ? 'th' : ( ($lastDigit === 1) ? 'st' : ( ($lastDigit === 2) ? 'nd' : ( ($lastDigit === 3) ? 'rd' : 'th' diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/en_CH.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/en_CH.php index e2dd81db5..10d9cd8f1 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/en_CH.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/en_CH.php @@ -11,4 +11,12 @@ return array_replace_recursive(require __DIR__.'/en.php', [ 'first_day_of_week' => 1, + 'formats' => [ + 'LT' => 'HH:mm', + 'LTS' => 'HH:mm:ss', + 'L' => 'DD.MM.YYYY', + 'LL' => 'D MMMM YYYY', + 'LLL' => 'D MMMM YYYY HH:mm', + 'LLLL' => 'dddd D MMMM YYYY HH:mm', + ], ]); diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/es.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/es.php index f77ec39c6..1c4fcfd0b 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/es.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/es.php @@ -26,6 +26,7 @@ * - quinterocesar * - Daniel Commesse Liévanos (danielcommesse) * - Pete Scopes (pdscopes) + * - gam04 */ use Carbon\CarbonInterface; @@ -108,4 +109,13 @@ return [ 'day_of_first_week_of_year' => 4, 'list' => [', ', ' y '], 'meridiem' => ['a. m.', 'p. m.'], + 'ordinal_words' => [ + 'of' => 'de', + 'first' => 'primer', + 'second' => 'segundo', + 'third' => 'tercer', + 'fourth' => 'cuarto', + 'fifth' => 'quinto', + 'last' => 'último', + ], ]; diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/fi.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/fi.php index 2003e1eab..edf2d6d35 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/fi.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/fi.php @@ -74,8 +74,10 @@ return [ 'LTS' => 'HH.mm:ss', 'L' => 'D.M.YYYY', 'LL' => 'dddd D. MMMM[ta] YYYY', + 'll' => 'ddd D. MMM YYYY', 'LLL' => 'D.MM. HH.mm', 'LLLL' => 'D. MMMM[ta] YYYY HH.mm', + 'llll' => 'D. MMM YY HH.mm', ], 'weekdays' => ['sunnuntai', 'maanantai', 'tiistai', 'keskiviikko', 'torstai', 'perjantai', 'lauantai'], 'weekdays_short' => ['su', 'ma', 'ti', 'ke', 'to', 'pe', 'la'], diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/fr.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/fr.php index 73fe5e41b..f4c7247b4 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/fr.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/fr.php @@ -90,7 +90,7 @@ return [ 'weekdays_min' => ['di', 'lu', 'ma', 'me', 'je', 've', 'sa'], 'ordinal' => function ($number, $period) { switch ($period) { - // In french, only the first has be ordinal, other number remains cardinal + // In French, only the first has to be ordinal, other number remains cardinal // @link https://fr.wikihow.com/%C3%A9crire-la-date-en-fran%C3%A7ais case 'D': return $number.($number === 1 ? 'er' : ''); @@ -111,4 +111,13 @@ return [ 'first_day_of_week' => 1, 'day_of_first_week_of_year' => 4, 'list' => [', ', ' et '], + 'ordinal_words' => [ + 'of' => 'de', + 'first' => 'premier', + 'second' => 'deuxième', + 'third' => 'troisième', + 'fourth' => 'quatrième', + 'fifth' => 'cinquième', + 'last' => 'dernier', + ], ]; diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/hu.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/hu.php index b2d2ac113..b7583eecd 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/hu.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/hu.php @@ -82,7 +82,7 @@ return [ 'second_before' => ':count másodperccel', 's_before' => ':count másodperccel', 'months' => ['január', 'február', 'március', 'április', 'május', 'június', 'július', 'augusztus', 'szeptember', 'október', 'november', 'december'], - 'months_short' => ['jan.', 'feb.', 'márc.', 'ápr.', 'máj.', 'jún.', 'júl.', 'aug.', 'szept.', 'okt.', 'nov.', 'dec.'], + 'months_short' => ['jan.', 'febr.', 'márc.', 'ápr.', 'máj.', 'jún.', 'júl.', 'aug.', 'szept.', 'okt.', 'nov.', 'dec.'], 'weekdays' => ['vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat'], 'weekdays_short' => ['vas', 'hét', 'kedd', 'sze', 'csüt', 'pén', 'szo'], 'weekdays_min' => ['v', 'h', 'k', 'sze', 'cs', 'p', 'sz'], diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/it.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/it.php index 605bcbb5a..49875d7ef 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/it.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/it.php @@ -55,7 +55,7 @@ return [ 'µs' => ':countµs', 'ago' => ':time fa', 'from_now' => function ($time) { - return (preg_match('/^[0-9].+$/', $time) ? 'tra' : 'in')." $time"; + return (preg_match('/^\d.+$/', $time) ? 'tra' : 'in')." $time"; }, 'after' => ':time dopo', 'before' => ':time prima', @@ -103,4 +103,13 @@ return [ 'first_day_of_week' => 1, 'day_of_first_week_of_year' => 4, 'list' => [', ', ' e '], + 'ordinal_words' => [ + 'of' => 'di', + 'first' => 'primo', + 'second' => 'secondo', + 'third' => 'terzo', + 'fourth' => 'quarto', + 'fifth' => 'quinto', + 'last' => 'ultimo', + ], ]; diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ku.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ku.php index b001e3015..189960c8a 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ku.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ku.php @@ -11,31 +11,29 @@ /* * Authors: - * - Halwest Manguri - * - Kardo Qadir + * - Unicode, Inc. */ -$months = ['کانونی دووەم', 'شوبات', 'ئازار', 'نیسان', 'ئایار', '‌حوزەیران', 'تەمموز', 'ئاب', 'ئەیلول', 'تشرینی یەکەم', 'تشرینی دووەم', 'کانونی یەکەم']; - -$weekdays = ['دوو شەممە', 'سێ شەممە', 'چوار شەممە', 'پێنج شەممە', 'هەینی', 'شەممە', 'یەک شەممە']; return [ - 'ago' => 'پێش :time', - 'from_now' => ':time لە ئێستاوە', - 'after' => 'دوای :time', - 'before' => 'پێش :time', - 'year' => '{0}ساڵ|{1}ساڵێک|{2}٢ ساڵ|[3,10]:count ساڵ|[11,Inf]:count ساڵ', - 'month' => '{0}مانگ|{1}مانگێک|{2}٢ مانگ|[3,10]:count مانگ|[11,Inf]:count مانگ', - 'week' => '{0}هەفتە|{1}هەفتەیەک|{2}٢ هەفتە|[3,10]:count هەفتە|[11,Inf]:count هەفتە', - 'day' => '{0}ڕۆژ|{1}ڕۆژێک|{2}٢ ڕۆژ|[3,10]:count ڕۆژ|[11,Inf]:count ڕۆژ', - 'hour' => '{0}کاتژمێر|{1}کاتژمێرێک|{2}٢ کاتژمێر|[3,10]:count کاتژمێر|[11,Inf]:count کاتژمێر', - 'minute' => '{0}خولەک|{1}خولەکێک|{2}٢ خولەک|[3,10]:count خولەک|[11,Inf]:count خولەک', - 'second' => '{0}چرکە|{1}چرکەیەک|{2}٢ چرکە|[3,10]:count چرکە|[11,Inf]:count چرکە', - 'months' => $months, - 'months_standalone' => $months, - 'months_short' => $months, - 'weekdays' => $weekdays, - 'weekdays_short' => $weekdays, - 'weekdays_min' => $weekdays, + 'ago' => 'berî :time', + 'from_now' => 'di :time de', + 'after' => ':time piştî', + 'before' => ':time berê', + 'year' => ':count sal', + 'year_ago' => ':count salê|:count salan', + 'year_from_now' => 'salekê|:count salan', + 'month' => ':count meh', + 'week' => ':count hefte', + 'day' => ':count roj', + 'hour' => ':count saet', + 'minute' => ':count deqîqe', + 'second' => ':count saniye', + 'months' => ['rêbendanê', 'reşemiyê', 'adarê', 'avrêlê', 'gulanê', 'pûşperê', 'tîrmehê', 'gelawêjê', 'rezberê', 'kewçêrê', 'sermawezê', 'berfanbarê'], + 'months_standalone' => ['rêbendan', 'reşemî', 'adar', 'avrêl', 'gulan', 'pûşper', 'tîrmeh', 'gelawêj', 'rezber', 'kewçêr', 'sermawez', 'berfanbar'], + 'months_short' => ['rêb', 'reş', 'ada', 'avr', 'gul', 'pûş', 'tîr', 'gel', 'rez', 'kew', 'ser', 'ber'], + 'weekdays' => ['yekşem', 'duşem', 'sêşem', 'çarşem', 'pêncşem', 'în', 'şemî'], + 'weekdays_short' => ['yş', 'dş', 'sş', 'çş', 'pş', 'în', 'ş'], + 'weekdays_min' => ['Y', 'D', 'S', 'Ç', 'P', 'Î', 'Ş'], 'list' => [', ', ' û '], 'first_day_of_week' => 6, 'day_of_first_week_of_year' => 1, diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/lv.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/lv.php index 693eceb5a..d5cba7ca0 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/lv.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/lv.php @@ -176,7 +176,8 @@ return [ 'weekdays' => $daysOfWeek, 'weekdays_short' => ['Sv.', 'P.', 'O.', 'T.', 'C.', 'Pk.', 'S.'], 'weekdays_min' => ['Sv.', 'P.', 'O.', 'T.', 'C.', 'Pk.', 'S.'], - 'months' => ['janvārī', 'februārī', 'martā', 'aprīlī', 'maijā', 'jūnijā', 'jūlijā', 'augustā', 'septembrī', 'oktobrī', 'novembrī', 'decembrī'], + 'months' => ['janvāris', 'februāris', 'marts', 'aprīlis', 'maijs', 'jūnijs', 'jūlijs', 'augusts', 'septembris', 'oktobris', 'novembris', 'decembris'], + 'months_standalone' => ['janvārī', 'februārī', 'martā', 'aprīlī', 'maijā', 'jūnijā', 'jūlijā', 'augustā', 'septembrī', 'oktobrī', 'novembrī', 'decembrī'], 'months_short' => ['janv.', 'febr.', 'martā', 'apr.', 'maijā', 'jūn.', 'jūl.', 'aug.', 'sept.', 'okt.', 'nov.', 'dec.'], 'meridiem' => ['priekšpusdiena', 'pēcpusdiena'], ]; diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/mn.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/mn.php index 717d199bc..38c6434d3 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/mn.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/mn.php @@ -26,6 +26,7 @@ * - Nicolás Hock Isaza * - Ochirkhuyag * - Batmandakh + * - lucifer-crybaby */ return [ 'year' => ':count жил', @@ -43,38 +44,55 @@ return [ 'second' => ':count секунд', 's' => ':countс', - 'ago' => ':timeн өмнө', - 'year_ago' => ':count жилий', - 'month_ago' => ':count сары', - 'day_ago' => ':count хоногий', - 'hour_ago' => ':count цагий', - 'minute_ago' => ':count минуты', - 'second_ago' => ':count секунды', + 'ago_mode' => 'last', + 'ago' => ':time өмнө', + 'year_ago' => ':count жилийн', + 'y_ago' => ':count жилийн', + 'month_ago' => ':count сарын', + 'm_ago' => ':count сарын', + 'day_ago' => ':count хоногийн', + 'd_ago' => ':count хоногийн', + 'week_ago' => ':count долоо хоногийн', + 'w_ago' => ':count долоо хоногийн', + 'hour_ago' => ':count цагийн', + 'minute_ago' => ':count минутын', + 'second_ago' => ':count секундын', + 'from_now_mode' => 'last', 'from_now' => 'одоогоос :time', 'year_from_now' => ':count жилийн дараа', + 'y_from_now' => ':count жилийн дараа', 'month_from_now' => ':count сарын дараа', + 'm_from_now' => ':count сарын дараа', 'day_from_now' => ':count хоногийн дараа', + 'd_from_now' => ':count хоногийн дараа', 'hour_from_now' => ':count цагийн дараа', 'minute_from_now' => ':count минутын дараа', 'second_from_now' => ':count секундын дараа', - // Does it required to make translation for before, after as follows? hmm, I think we've made it with ago and from now keywords already. Anyway, I've included it just in case of undesired action... - 'after' => ':timeн дараа', - 'year_after' => ':count жилий', - 'month_after' => ':count сары', - 'day_after' => ':count хоногий', - 'hour_after' => ':count цагий', - 'minute_after' => ':count минуты', - 'second_after' => ':count секунды', + 'after_mode' => 'last', + 'after' => ':time дараа', + 'year_after' => ':count жилийн', + 'y_after' => ':count жилийн', + 'month_after' => ':count сарын', + 'm_after' => ':count сарын', + 'day_after' => ':count хоногийн', + 'd_after' => ':count хоногийн', + 'hour_after' => ':count цагийн', + 'minute_after' => ':count минутын', + 'second_after' => ':count секундын', - 'before' => ':timeн өмнө', - 'year_before' => ':count жилий', - 'month_before' => ':count сары', - 'day_before' => ':count хоногий', - 'hour_before' => ':count цагий', - 'minute_before' => ':count минуты', - 'second_before' => ':count секунды', + 'before_mode' => 'last', + 'before' => ':time өмнө', + 'year_before' => ':count жилийн', + 'y_before' => ':count жилийн', + 'month_before' => ':count сарын', + 'm_before' => ':count сарын', + 'day_before' => ':count хоногийн', + 'd_before' => ':count хоногийн', + 'hour_before' => ':count цагийн', + 'minute_before' => ':count минутын', + 'second_before' => ':count секундын', 'list' => ', ', 'diff_now' => 'одоо', diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ms.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ms.php index 36934eeb1..c9e80854f 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ms.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ms.php @@ -48,7 +48,7 @@ return [ 'ago' => ':time yang lepas', 'from_now' => ':time dari sekarang', 'after' => ':time kemudian', - 'before' => ':time lepas', + 'before' => ':time sebelum', 'diff_now' => 'sekarang', 'diff_today' => 'Hari', 'diff_today_regexp' => 'Hari(?:\\s+ini)?(?:\\s+pukul)?', diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/oc.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/oc.php index 89693e674..c9411d69d 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/oc.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/oc.php @@ -17,7 +17,7 @@ use Symfony\Component\Translation\PluralizationRules; if (class_exists('Symfony\\Component\\Translation\\PluralizationRules')) { - PluralizationRules::set(function ($number) { + PluralizationRules::set(static function ($number) { return $number == 1 ? 0 : 1; }, 'oc'); } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/pl.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/pl.php index f0196c0d6..b72053549 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/pl.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/pl.php @@ -62,7 +62,7 @@ return [ }, 'after' => ':time po', 'before' => ':time przed', - 'diff_now' => 'przed chwilą', + 'diff_now' => 'teraz', 'diff_today' => 'Dziś', 'diff_today_regexp' => 'Dziś(?:\\s+o)?', 'diff_yesterday' => 'wczoraj', diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/pt.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/pt.php index 0af894994..bb6359b14 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/pt.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/pt.php @@ -104,4 +104,13 @@ return [ 'first_day_of_week' => 1, 'day_of_first_week_of_year' => 4, 'list' => [', ', ' e '], + 'ordinal_words' => [ + 'of' => 'de', + 'first' => 'primeira', + 'second' => 'segunda', + 'third' => 'terceira', + 'fourth' => 'quarta', + 'fifth' => 'quinta', + 'last' => 'última', + ], ]; diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sh.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sh.php index e4aa5a1c7..e03b50675 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sh.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sh.php @@ -13,7 +13,7 @@ use Symfony\Component\Translation\PluralizationRules; if (class_exists('Symfony\\Component\\Translation\\PluralizationRules')) { - PluralizationRules::set(function ($number) { + PluralizationRules::set(static function ($number) { return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); }, 'sh'); } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sk.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sk.php index fd0f6b3e9..f9702e960 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sk.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sk.php @@ -31,33 +31,89 @@ * - jofi * - Jakub ADAMEC * - Marek Adamický + * - AlterwebStudio */ + +use Carbon\CarbonInterface; + +$fromNow = function ($time) { + return 'o '.strtr($time, [ + 'hodina' => 'hodinu', + 'minúta' => 'minútu', + 'sekunda' => 'sekundu', + ]); +}; + +$ago = function ($time) { + $replacements = [ + '/\bhodina\b/' => 'hodinou', + '/\bminúta\b/' => 'minútou', + '/\bsekunda\b/' => 'sekundou', + '/\bdeň\b/u' => 'dňom', + '/\btýždeň\b/u' => 'týždňom', + '/\bmesiac\b/' => 'mesiacom', + '/\brok\b/' => 'rokom', + ]; + + $replacementsPlural = [ + '/\bhodiny\b/' => 'hodinami', + '/\bminúty\b/' => 'minútami', + '/\bsekundy\b/' => 'sekundami', + '/\bdni\b/' => 'dňami', + '/\btýždne\b/' => 'týždňami', + '/\bmesiace\b/' => 'mesiacmi', + '/\broky\b/' => 'rokmi', + ]; + + foreach ($replacements + $replacementsPlural as $pattern => $replacement) { + $time = preg_replace($pattern, $replacement, $time); + } + + return "pred $time"; +}; + return [ - 'year' => 'rok|:count roky|:count rokov', + 'year' => ':count rok|:count roky|:count rokov', + 'a_year' => 'rok|:count roky|:count rokov', 'y' => ':count r', - 'month' => 'mesiac|:count mesiace|:count mesiacov', + 'month' => ':count mesiac|:count mesiace|:count mesiacov', + 'a_month' => 'mesiac|:count mesiace|:count mesiacov', 'm' => ':count m', - 'week' => 'týždeň|:count týždne|:count týždňov', + 'week' => ':count týždeň|:count týždne|:count týždňov', + 'a_week' => 'týždeň|:count týždne|:count týždňov', 'w' => ':count t', - 'day' => 'deň|:count dni|:count dní', + 'day' => ':count deň|:count dni|:count dní', + 'a_day' => 'deň|:count dni|:count dní', 'd' => ':count d', - 'hour' => 'hodinu|:count hodiny|:count hodín', + 'hour' => ':count hodina|:count hodiny|:count hodín', + 'a_hour' => 'hodina|:count hodiny|:count hodín', 'h' => ':count h', - 'minute' => 'minútu|:count minúty|:count minút', + 'minute' => ':count minúta|:count minúty|:count minút', + 'a_minute' => 'minúta|:count minúty|:count minút', 'min' => ':count min', - 'second' => 'sekundu|:count sekundy|:count sekúnd', + 'second' => ':count sekunda|:count sekundy|:count sekúnd', + 'a_second' => 'sekunda|:count sekundy|:count sekúnd', 's' => ':count s', - 'ago' => 'pred :time', - 'from_now' => 'za :time', - 'after' => 'o :time neskôr', - 'before' => ':time predtým', - 'year_ago' => 'rokom|:count rokmi|:count rokmi', - 'month_ago' => 'mesiacom|:count mesiacmi|:count mesiacmi', - 'week_ago' => 'týždňom|:count týždňami|:count týždňami', - 'day_ago' => 'dňom|:count dňami|:count dňami', - 'hour_ago' => 'hodinou|:count hodinami|:count hodinami', - 'minute_ago' => 'minútou|:count minútami|:count minútami', - 'second_ago' => 'sekundou|:count sekundami|:count sekundami', + 'millisecond' => ':count milisekunda|:count milisekundy|:count milisekúnd', + 'a_millisecond' => 'milisekunda|:count milisekundy|:count milisekúnd', + 'ms' => ':count ms', + 'microsecond' => ':count mikrosekunda|:count mikrosekundy|:count mikrosekúnd', + 'a_microsecond' => 'mikrosekunda|:count mikrosekundy|:count mikrosekúnd', + 'µs' => ':count µs', + + 'ago' => $ago, + 'from_now' => $fromNow, + 'before' => ':time pred', + 'after' => ':time po', + + 'hour_after' => ':count hodinu|:count hodiny|:count hodín', + 'minute_after' => ':count minútu|:count minúty|:count minút', + 'second_after' => ':count sekundu|:count sekundy|:count sekúnd', + + 'hour_before' => ':count hodinu|:count hodiny|:count hodín', + 'minute_before' => ':count minútu|:count minúty|:count minút', + 'second_before' => ':count sekundu|:count sekundy|:count sekúnd', + 'first_day_of_week' => 1, 'day_of_first_week_of_year' => 4, 'list' => [', ', ' a '], @@ -72,8 +128,26 @@ return [ 'LLL' => 'D. M. HH:mm', 'LLLL' => 'dddd D. MMMM YYYY HH:mm', ], + 'calendar' => [ + 'sameDay' => '[dnes o] LT', + 'nextDay' => '[zajtra o] LT', + 'lastDay' => '[včera o] LT', + 'nextWeek' => 'dddd [o] LT', + 'lastWeek' => static function (CarbonInterface $date) { + switch ($date->dayOfWeek) { + case 1: + case 2: + case 4: + case 5: + return '[minulý] dddd [o] LT'; //pondelok/utorok/štvrtok/piatok + default: + return '[minulá] dddd [o] LT'; + } + }, + 'sameElse' => 'L', + ], 'weekdays' => ['nedeľa', 'pondelok', 'utorok', 'streda', 'štvrtok', 'piatok', 'sobota'], - 'weekdays_short' => ['ne', 'po', 'ut', 'st', 'št', 'pi', 'so'], + 'weekdays_short' => ['ned', 'pon', 'uto', 'str', 'štv', 'pia', 'sob'], 'weekdays_min' => ['ne', 'po', 'ut', 'st', 'št', 'pi', 'so'], 'months' => ['január', 'február', 'marec', 'apríl', 'máj', 'jún', 'júl', 'august', 'september', 'október', 'november', 'december'], 'months_short' => ['jan', 'feb', 'mar', 'apr', 'máj', 'jún', 'júl', 'aug', 'sep', 'okt', 'nov', 'dec'], diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sl.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sl.php index 2e197212b..1f1d1b338 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sl.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sl.php @@ -49,9 +49,9 @@ return [ 'a_second' => '{1}nekaj sekund|:count sekunda|:count sekundi|:count sekunde|:count sekund', 's' => ':count s', - 'year_ago' => ':count letom|:count leti|:count leti|:count leti', - 'y_ago' => ':count letom|:count leti|:count leti|:count leti', - 'month_ago' => ':count mesecem|:count meseci|:count meseci|:count meseci', + 'year_ago' => ':count letom|:count letoma|:count leti|:count leti', + 'y_ago' => ':count letom|:count letoma|:count leti|:count leti', + 'month_ago' => ':count mesecem|:count mesecema|:count meseci|:count meseci', 'week_ago' => ':count tednom|:count tednoma|:count tedni|:count tedni', 'day_ago' => ':count dnem|:count dnevoma|:count dnevi|:count dnevi', 'd_ago' => ':count dnem|:count dnevoma|:count dnevi|:count dnevi', diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php index c09df19cf..8becbc576 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php @@ -24,28 +24,28 @@ use Carbon\CarbonInterface; return [ - 'year' => '{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count године|[0,Inf[:count година', + 'year' => ':count година|:count године|:count година', 'y' => ':count г.', - 'month' => '{1}:count месец|{2,3,4}:count месеца|[0,Inf[:count месеци', + 'month' => ':count месец|:count месеца|:count месеци', 'm' => ':count м.', - 'week' => '{1}:count недеља|{2,3,4}:count недеље|[0,Inf[:count недеља', + 'week' => ':count недеља|:count недеље|:count недеља', 'w' => ':count нед.', - 'day' => '{1,21,31}:count дан|[0,Inf[:count дана', + 'day' => ':count дан|:count дана|:count дана', 'd' => ':count д.', - 'hour' => '{1,21}:count сат|{2,3,4,22,23,24}:count сата|[0,Inf[:count сати', + 'hour' => ':count сат|:count сата|:count сати', 'h' => ':count ч.', - 'minute' => '{1,21,31,41,51}:count минут|[0,Inf[:count минута', + 'minute' => ':count минут|:count минута|:count минута', 'min' => ':count мин.', - 'second' => '{1,21,31,41,51}:count секунд|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count секунде|[0,Inf[:count секунди', + 'second' => ':count секунд|:count секунде|:count секунди', 's' => ':count сек.', 'ago' => 'пре :time', 'from_now' => 'за :time', 'after' => ':time након', 'before' => ':time пре', - 'year_from_now' => '{1,21,31,41,51}:count годину|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count године|[0,Inf[:count година', - 'year_ago' => '{1,21,31,41,51}:count годину|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count године|[0,Inf[:count година', - 'week_from_now' => '{1}:count недељу|{2,3,4}:count недеље|[0,Inf[:count недеља', - 'week_ago' => '{1}:count недељу|{2,3,4}:count недеље|[0,Inf[:count недеља', + 'year_from_now' => ':count годину|:count године|:count година', + 'year_ago' => ':count годину|:count године|:count година', + 'week_from_now' => ':count недељу|:count недеље|:count недеља', + 'week_ago' => ':count недељу|:count недеље|:count недеља', 'diff_now' => 'управо сада', 'diff_today' => 'данас', 'diff_today_regexp' => 'данас(?:\\s+у)?', diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_BA.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_BA.php index 0fb63d769..4b29a45c7 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_BA.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_BA.php @@ -9,6 +9,16 @@ * file that was distributed with this source code. */ +use Symfony\Component\Translation\PluralizationRules; + +// @codeCoverageIgnoreStart +if (class_exists(PluralizationRules::class)) { + PluralizationRules::set(static function ($number) { + return PluralizationRules::get($number, 'sr'); + }, 'sr_Cyrl_BA'); +} +// @codeCoverageIgnoreEnd + return array_replace_recursive(require __DIR__.'/sr_Cyrl.php', [ 'formats' => [ 'LT' => 'HH:mm', diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php index d13229abc..28d22fd2c 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php @@ -16,32 +16,41 @@ */ use Carbon\CarbonInterface; +use Symfony\Component\Translation\PluralizationRules; + +// @codeCoverageIgnoreStart +if (class_exists(PluralizationRules::class)) { + PluralizationRules::set(static function ($number) { + return PluralizationRules::get($number, 'sr'); + }, 'sr_Cyrl_ME'); +} +// @codeCoverageIgnoreEnd return [ - 'year' => '{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count године|[0,Inf[:count година', + 'year' => ':count година|:count године|:count година', 'y' => ':count г.', - 'month' => '{1}:count мјесец|{2,3,4}:count мјесеца|[0,Inf[:count мјесеци', + 'month' => ':count мјесец|:count мјесеца|:count мјесеци', 'm' => ':count мј.', - 'week' => '{1}:count недјеља|{2,3,4}:count недјеље|[0,Inf[:count недјеља', + 'week' => ':count недјеља|:count недјеље|:count недјеља', 'w' => ':count нед.', - 'day' => '{1,21,31}:count дан|[0,Inf[:count дана', + 'day' => ':count дан|:count дана|:count дана', 'd' => ':count д.', - 'hour' => '{1,21}:count сат|{2,3,4,22,23,24}:count сата|[0,Inf[:count сати', + 'hour' => ':count сат|:count сата|:count сати', 'h' => ':count ч.', - 'minute' => '{1,21,31,41,51}:count минут|[0,Inf[:count минута', + 'minute' => ':count минут|:count минута|:count минута', 'min' => ':count мин.', - 'second' => '{1,21,31,41,51}:count секунд|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count секунде|[0,Inf[:count секунди', + 'second' => ':count секунд|:count секунде|:count секунди', 's' => ':count сек.', 'ago' => 'прије :time', 'from_now' => 'за :time', 'after' => ':time након', 'before' => ':time прије', - 'year_from_now' => '{1,21,31,41,51}:count годину|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count године|[0,Inf[:count година', - 'year_ago' => '{1,21,31,41,51}:count годину|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54}:count године|[0,Inf[:count година', + 'year_from_now' => ':count годину|:count године|:count година', + 'year_ago' => ':count годину|:count године|:count година', - 'week_from_now' => '{1}:count недјељу|{2,3,4}:count недјеље|[0,Inf[:count недјеља', - 'week_ago' => '{1}:count недјељу|{2,3,4}:count недјеље|[0,Inf[:count недјеља', + 'week_from_now' => ':count недјељу|:count недјеље|:count недјеља', + 'week_ago' => ':count недјељу|:count недјеље|:count недјеља', 'diff_now' => 'управо сада', 'diff_today' => 'данас', diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_XK.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_XK.php index 492baf0cb..d6e29b86b 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_XK.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_XK.php @@ -9,6 +9,16 @@ * file that was distributed with this source code. */ +use Symfony\Component\Translation\PluralizationRules; + +// @codeCoverageIgnoreStart +if (class_exists(PluralizationRules::class)) { + PluralizationRules::set(static function ($number) { + return PluralizationRules::get($number, 'sr'); + }, 'sr_Cyrl_XK'); +} +// @codeCoverageIgnoreEnd + return array_replace_recursive(require __DIR__.'/sr_Cyrl_BA.php', [ 'weekdays' => ['недеља', 'понедељак', 'уторак', 'среда', 'четвртак', 'петак', 'субота'], ]); diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_BA.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_BA.php index 897c674a5..95b2770db 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_BA.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_BA.php @@ -9,6 +9,16 @@ * file that was distributed with this source code. */ +use Symfony\Component\Translation\PluralizationRules; + +// @codeCoverageIgnoreStart +if (class_exists(PluralizationRules::class)) { + PluralizationRules::set(static function ($number) { + return PluralizationRules::get($number, 'sr'); + }, 'sr_Latn_BA'); +} +// @codeCoverageIgnoreEnd + return array_replace_recursive(require __DIR__.'/sr_Latn.php', [ 'formats' => [ 'LT' => 'HH:mm', diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php index e2133ef1a..5b8f2d062 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php @@ -16,6 +16,15 @@ */ use Carbon\CarbonInterface; +use Symfony\Component\Translation\PluralizationRules; + +// @codeCoverageIgnoreStart +if (class_exists(PluralizationRules::class)) { + PluralizationRules::set(static function ($number) { + return PluralizationRules::get($number, 'sr'); + }, 'sr_Latn_ME'); +} +// @codeCoverageIgnoreEnd return array_replace_recursive(require __DIR__.'/sr.php', [ 'month' => ':count mjesec|:count mjeseca|:count mjeseci', @@ -27,6 +36,7 @@ return array_replace_recursive(require __DIR__.'/sr.php', [ 'before' => ':time prije', 'week_from_now' => ':count nedjelju|:count nedjelje|:count nedjelja', 'week_ago' => ':count nedjelju|:count nedjelje|:count nedjelja', + 'second_ago' => ':count sekund|:count sekunde|:count sekundi', 'diff_tomorrow' => 'sjutra', 'calendar' => [ 'nextDay' => '[sjutra u] LT', diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_XK.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_XK.php index d0b9d10bb..5278e2e5a 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_XK.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_XK.php @@ -9,6 +9,16 @@ * file that was distributed with this source code. */ +use Symfony\Component\Translation\PluralizationRules; + +// @codeCoverageIgnoreStart +if (class_exists(PluralizationRules::class)) { + PluralizationRules::set(static function ($number) { + return PluralizationRules::get($number, 'sr'); + }, 'sr_Latn_XK'); +} +// @codeCoverageIgnoreEnd + return array_replace_recursive(require __DIR__.'/sr_Latn_BA.php', [ 'weekdays' => ['nedelja', 'ponedeljak', 'utorak', 'sreda', 'četvrtak', 'petak', 'subota'], ]); diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ss.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ss.php index cd4b91901..1c52c9bf6 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ss.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/ss.php @@ -50,7 +50,7 @@ return [ $lastDigit = $number % 10; return $number.( - (~~($number % 100 / 10) === 1) ? 'e' : ( + ((int) ($number % 100 / 10) === 1) ? 'e' : ( ($lastDigit === 1 || $lastDigit === 2) ? 'a' : 'e' ) ); diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sv.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sv.php index ca33e1c45..1706c7191 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sv.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/sv.php @@ -70,7 +70,7 @@ return [ $lastDigit = $number % 10; return $number.( - (~~($number % 100 / 10) === 1) ? 'e' : ( + ((int) ($number % 100 / 10) === 1) ? 'e' : ( ($lastDigit === 1 || $lastDigit === 2) ? 'a' : 'e' ) ); diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/uk.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/uk.php index b267b0002..4217d16ed 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/uk.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Lang/uk.php @@ -55,7 +55,7 @@ $processHoursFunction = function (CarbonInterface $date, string $format) { */ return [ 'year' => ':count рік|:count роки|:count років', - 'y' => ':countр', + 'y' => ':countр|:countрр|:countрр', 'a_year' => '{1}рік|:count рік|:count роки|:count років', 'month' => ':count місяць|:count місяці|:count місяців', 'm' => ':countм', @@ -193,6 +193,7 @@ return [ 'genitive' => ['неділі', 'понеділка', 'вівторка', 'середи', 'четверга', 'п’ятниці', 'суботи'], ]; + $format = $format ?? ''; $nounCase = preg_match('/(\[(В|в|У|у)\])\s+dddd/u', $format) ? 'accusative' : ( diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php index 8be0569e8..84e241e3e 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php @@ -24,6 +24,22 @@ use Throwable; class ServiceProvider extends \Illuminate\Support\ServiceProvider { + /** @var callable|null */ + protected $appGetter = null; + + /** @var callable|null */ + protected $localeGetter = null; + + public function setAppGetter(?callable $appGetter): void + { + $this->appGetter = $appGetter; + } + + public function setLocaleGetter(?callable $localeGetter): void + { + $this->localeGetter = $localeGetter; + } + public function boot() { $this->updateLocale(); @@ -44,8 +60,12 @@ class ServiceProvider extends \Illuminate\Support\ServiceProvider public function updateLocale() { - $app = $this->app && method_exists($this->app, 'getLocale') ? $this->app : app('translator'); - $locale = $app->getLocale(); + $locale = $this->getLocale(); + + if ($locale === null) { + return; + } + Carbon::setLocale($locale); CarbonImmutable::setLocale($locale); CarbonPeriod::setLocale($locale); @@ -70,6 +90,34 @@ class ServiceProvider extends \Illuminate\Support\ServiceProvider // Needed for Laravel < 5.3 compatibility } + protected function getLocale() + { + if ($this->localeGetter) { + return ($this->localeGetter)(); + } + + $app = $this->getApp(); + $app = $app && method_exists($app, 'getLocale') + ? $app + : $this->getGlobalApp('translator'); + + return $app ? $app->getLocale() : null; + } + + protected function getApp() + { + if ($this->appGetter) { + return ($this->appGetter)(); + } + + return $this->app ?? $this->getGlobalApp(); + } + + protected function getGlobalApp(...$args) + { + return \function_exists('app') ? \app(...$args) : null; + } + protected function isEventDispatcher($instance) { return $instance instanceof EventDispatcher diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/MessageFormatter/MessageFormatterMapper.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/MessageFormatter/MessageFormatterMapper.php new file mode 100644 index 000000000..c05480876 --- /dev/null +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/MessageFormatter/MessageFormatterMapper.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\MessageFormatter; + +use ReflectionMethod; +use Symfony\Component\Translation\Formatter\MessageFormatter; +use Symfony\Component\Translation\Formatter\MessageFormatterInterface; + +// @codeCoverageIgnoreStart +$transMethod = new ReflectionMethod(MessageFormatterInterface::class, 'format'); + +require $transMethod->getParameters()[0]->hasType() + ? __DIR__.'/../../../lazy/Carbon/MessageFormatter/MessageFormatterMapperStrongType.php' + : __DIR__.'/../../../lazy/Carbon/MessageFormatter/MessageFormatterMapperWeakType.php'; +// @codeCoverageIgnoreEnd + +final class MessageFormatterMapper extends LazyMessageFormatter +{ + /** + * Wrapped formatter. + * + * @var MessageFormatterInterface + */ + protected $formatter; + + public function __construct(?MessageFormatterInterface $formatter = null) + { + $this->formatter = $formatter ?? new MessageFormatter(); + } + + protected function transformLocale(?string $locale): ?string + { + return $locale ? preg_replace('/[_@][A-Za-z][a-z]{2,}/', '', $locale) : $locale; + } +} diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/PHPStan/AbstractMacro.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/PHPStan/AbstractMacro.php index fc6fd2a79..fde67b36a 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/PHPStan/AbstractMacro.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/PHPStan/AbstractMacro.php @@ -14,6 +14,12 @@ declare(strict_types=1); namespace Carbon\PHPStan; use Closure; +use InvalidArgumentException; +use PHPStan\BetterReflection\Reflection\Adapter\ReflectionParameter as AdapterReflectionParameter; +use PHPStan\BetterReflection\Reflection\Adapter\ReflectionType as AdapterReflectionType; +use PHPStan\BetterReflection\Reflection\ReflectionClass as BetterReflectionClass; +use PHPStan\BetterReflection\Reflection\ReflectionFunction as BetterReflectionFunction; +use PHPStan\BetterReflection\Reflection\ReflectionParameter as BetterReflectionParameter; use PHPStan\Reflection\Php\BuiltinMethodReflection; use PHPStan\TrinaryLogic; use ReflectionClass; @@ -64,24 +70,34 @@ abstract class AbstractMacro implements BuiltinMethodReflection /** * Macro constructor. * - * @param string $className - * @phpstan-param class-string $className - * - * @param string $methodName - * @param callable $macro + * @param class-string $className + * @param string $methodName + * @param callable $macro */ public function __construct(string $className, string $methodName, $macro) { $this->className = $className; $this->methodName = $methodName; - $this->reflectionFunction = \is_array($macro) + $rawReflectionFunction = \is_array($macro) ? new ReflectionMethod($macro[0], $macro[1]) : new ReflectionFunction($macro); - $this->parameters = $this->reflectionFunction->getParameters(); + $this->reflectionFunction = self::hasModernParser() + ? $this->getReflectionFunction($macro) + : $rawReflectionFunction; // @codeCoverageIgnore + $this->parameters = array_map( + function ($parameter) { + if ($parameter instanceof BetterReflectionParameter) { + return new AdapterReflectionParameter($parameter); + } - if ($this->reflectionFunction->isClosure()) { + return $parameter; // @codeCoverageIgnore + }, + $this->reflectionFunction->getParameters() + ); + + if ($rawReflectionFunction->isClosure()) { try { - $closure = $this->reflectionFunction->getClosure(); + $closure = $rawReflectionFunction->getClosure(); $boundClosure = Closure::bind($closure, new stdClass()); $this->static = (!$boundClosure || (new ReflectionFunction($boundClosure))->getClosureThis() === null); } catch (Throwable $e) { @@ -90,6 +106,31 @@ abstract class AbstractMacro implements BuiltinMethodReflection } } + private function getReflectionFunction($spec) + { + if (\is_array($spec) && \count($spec) === 2 && \is_string($spec[1])) { + \assert($spec[1] !== ''); + + if (\is_object($spec[0])) { + return BetterReflectionClass::createFromInstance($spec[0]) + ->getMethod($spec[1]); + } + + return BetterReflectionClass::createFromName($spec[0]) + ->getMethod($spec[1]); + } + + if (\is_string($spec)) { + return BetterReflectionFunction::createFromName($spec); + } + + if ($spec instanceof Closure) { + return BetterReflectionFunction::createFromClosure($spec); + } + + throw new InvalidArgumentException('Could not create reflection from the spec given'); // @codeCoverageIgnore + } + /** * {@inheritdoc} */ @@ -175,7 +216,13 @@ abstract class AbstractMacro implements BuiltinMethodReflection */ public function getReturnType(): ?ReflectionType { - return $this->reflectionFunction->getReturnType(); + $type = $this->reflectionFunction->getReturnType(); + + if ($type instanceof ReflectionType) { + return $type; // @codeCoverageIgnore + } + + return self::adaptType($type); } /** @@ -205,18 +252,35 @@ abstract class AbstractMacro implements BuiltinMethodReflection return $this; } - /** - * {@inheritdoc} - */ - public function getReflection(): ?ReflectionMethod - { - return $this->reflectionFunction instanceof ReflectionMethod - ? $this->reflectionFunction - : null; - } - public function getTentativeReturnType(): ?ReflectionType { return null; } + + public function returnsByReference(): TrinaryLogic + { + return TrinaryLogic::createNo(); + } + + private static function adaptType($type) + { + $method = method_exists(AdapterReflectionType::class, 'fromTypeOrNull') + ? 'fromTypeOrNull' + : 'fromReturnTypeOrNull'; // @codeCoverageIgnore + + return AdapterReflectionType::$method($type); + } + + private static function hasModernParser(): bool + { + static $modernParser = null; + + if ($modernParser !== null) { + return $modernParser; + } + + $modernParser = method_exists(AdapterReflectionType::class, 'fromTypeOrNull'); + + return $modernParser; + } } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/PHPStan/Macro.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/PHPStan/Macro.php index 839258736..de3e51f6a 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/PHPStan/Macro.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/PHPStan/Macro.php @@ -13,9 +13,16 @@ declare(strict_types=1); namespace Carbon\PHPStan; +use PHPStan\BetterReflection\Reflection\Adapter; use PHPStan\Reflection\Php\BuiltinMethodReflection; use ReflectionMethod; +$method = new ReflectionMethod(BuiltinMethodReflection::class, 'getReflection'); + +require $method->hasReturnType() && $method->getReturnType()->getName() === Adapter\ReflectionMethod::class + ? __DIR__.'/../../../lazy/Carbon/PHPStan/AbstractMacroStatic.php' + : __DIR__.'/../../../lazy/Carbon/PHPStan/AbstractMacroBuiltin.php'; + $method = new ReflectionMethod(BuiltinMethodReflection::class, 'getFileName'); require $method->hasReturnType() diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/PHPStan/MacroExtension.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/PHPStan/MacroExtension.php index 8e2524c09..2cd6fce54 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/PHPStan/MacroExtension.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/PHPStan/MacroExtension.php @@ -11,10 +11,12 @@ namespace Carbon\PHPStan; +use PHPStan\Reflection\Assertions; use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\MethodReflection; use PHPStan\Reflection\MethodsClassReflectionExtension; use PHPStan\Reflection\Php\PhpMethodReflectionFactory; +use PHPStan\Reflection\ReflectionProvider; use PHPStan\Type\TypehintHelper; /** @@ -38,10 +40,13 @@ final class MacroExtension implements MethodsClassReflectionExtension * Extension constructor. * * @param PhpMethodReflectionFactory $methodReflectionFactory + * @param ReflectionProvider $reflectionProvider */ - public function __construct(PhpMethodReflectionFactory $methodReflectionFactory) - { - $this->scanner = new MacroScanner(); + public function __construct( + PhpMethodReflectionFactory $methodReflectionFactory, + ReflectionProvider $reflectionProvider + ) { + $this->scanner = new MacroScanner($reflectionProvider); $this->methodReflectionFactory = $methodReflectionFactory; } @@ -59,6 +64,7 @@ final class MacroExtension implements MethodsClassReflectionExtension public function getMethod(ClassReflection $classReflection, string $methodName): MethodReflection { $builtinMacro = $this->scanner->getMethod($classReflection->getName(), $methodName); + $supportAssertions = class_exists(Assertions::class); return $this->methodReflectionFactory->create( $classReflection, @@ -72,7 +78,11 @@ final class MacroExtension implements MethodsClassReflectionExtension $builtinMacro->isDeprecated()->yes(), $builtinMacro->isInternal(), $builtinMacro->isFinal(), - $builtinMacro->getDocComment() + $supportAssertions ? null : $builtinMacro->getDocComment(), + $supportAssertions ? Assertions::createEmpty() : null, + null, + $builtinMacro->getDocComment(), + [] ); } } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/PHPStan/MacroScanner.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/PHPStan/MacroScanner.php index d169939d8..eb8957d4d 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/PHPStan/MacroScanner.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/PHPStan/MacroScanner.php @@ -12,35 +12,55 @@ namespace Carbon\PHPStan; use Carbon\CarbonInterface; +use PHPStan\Reflection\ReflectionProvider; use ReflectionClass; use ReflectionException; final class MacroScanner { + /** + * @var \PHPStan\Reflection\ReflectionProvider + */ + private $reflectionProvider; + + /** + * MacroScanner constructor. + * + * @param \PHPStan\Reflection\ReflectionProvider $reflectionProvider + */ + public function __construct(ReflectionProvider $reflectionProvider) + { + $this->reflectionProvider = $reflectionProvider; + } + /** * Return true if the given pair class-method is a Carbon macro. * - * @param string $className - * @phpstan-param class-string $className - * - * @param string $methodName + * @param class-string $className + * @param string $methodName * * @return bool */ public function hasMethod(string $className, string $methodName): bool { - return is_a($className, CarbonInterface::class, true) && - \is_callable([$className, 'hasMacro']) && + $classReflection = $this->reflectionProvider->getClass($className); + + if ( + $classReflection->getName() !== CarbonInterface::class && + !$classReflection->isSubclassOf(CarbonInterface::class) + ) { + return false; + } + + return \is_callable([$className, 'hasMacro']) && $className::hasMacro($methodName); } /** * Return the Macro for a given pair class-method. * - * @param string $className - * @phpstan-param class-string $className - * - * @param string $methodName + * @param class-string $className + * @param string $methodName * * @throws ReflectionException * diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Comparison.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Comparison.php index a23e6ed0c..f6261d882 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Comparison.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Comparison.php @@ -75,6 +75,9 @@ trait Comparison */ public function equalTo($date): bool { + $this->discourageNull($date); + $this->discourageBoolean($date); + return $this == $this->resolveCarbon($date); } @@ -155,6 +158,9 @@ trait Comparison */ public function greaterThan($date): bool { + $this->discourageNull($date); + $this->discourageBoolean($date); + return $this > $this->resolveCarbon($date); } @@ -216,7 +222,10 @@ trait Comparison */ public function greaterThanOrEqualTo($date): bool { - return $this >= $date; + $this->discourageNull($date); + $this->discourageBoolean($date); + + return $this >= $this->resolveCarbon($date); } /** @@ -256,6 +265,9 @@ trait Comparison */ public function lessThan($date): bool { + $this->discourageNull($date); + $this->discourageBoolean($date); + return $this < $this->resolveCarbon($date); } @@ -317,7 +329,10 @@ trait Comparison */ public function lessThanOrEqualTo($date): bool { - return $this <= $date; + $this->discourageNull($date); + $this->discourageBoolean($date); + + return $this <= $this->resolveCarbon($date); } /** @@ -351,10 +366,10 @@ trait Comparison } if ($equal) { - return $this->greaterThanOrEqualTo($date1) && $this->lessThanOrEqualTo($date2); + return $this >= $date1 && $this <= $date2; } - return $this->greaterThan($date1) && $this->lessThan($date2); + return $this > $date1 && $this < $date2; } /** @@ -448,7 +463,7 @@ trait Comparison */ public function isWeekend() { - return \in_array($this->dayOfWeek, static::$weekendDays); + return \in_array($this->dayOfWeek, static::$weekendDays, true); } /** @@ -548,12 +563,17 @@ trait Comparison } /** - * Determines if the instance is a long year + * Determines if the instance is a long year (using calendar year). + * + * ⚠️ This method completely ignores month and day to use the numeric year number, + * it's not correct if the exact date matters. For instance as `2019-12-30` is already + * in the first week of the 2020 year, if you want to know from this date if ISO week + * year 2020 is a long year, use `isLongIsoYear` instead. * * @example * ``` - * Carbon::parse('2015-01-01')->isLongYear(); // true - * Carbon::parse('2016-01-01')->isLongYear(); // false + * Carbon::create(2015)->isLongYear(); // true + * Carbon::create(2016)->isLongYear(); // false * ``` * * @see https://en.wikipedia.org/wiki/ISO_8601#Week_dates @@ -565,6 +585,27 @@ trait Comparison return static::create($this->year, 12, 28, 0, 0, 0, $this->tz)->weekOfYear === 53; } + /** + * Determines if the instance is a long year (using ISO 8601 year). + * + * @example + * ``` + * Carbon::parse('2015-01-01')->isLongIsoYear(); // true + * Carbon::parse('2016-01-01')->isLongIsoYear(); // true + * Carbon::parse('2016-01-03')->isLongIsoYear(); // false + * Carbon::parse('2019-12-29')->isLongIsoYear(); // false + * Carbon::parse('2019-12-30')->isLongIsoYear(); // true + * ``` + * + * @see https://en.wikipedia.org/wiki/ISO_8601#Week_dates + * + * @return bool + */ + public function isLongIsoYear() + { + return static::create($this->isoWeekYear, 12, 28, 0, 0, 0, $this->tz)->weekOfYear === 53; + } + /** * Compares the formatted values of the two dates. * @@ -621,19 +662,19 @@ trait Comparison 'microsecond' => 'Y-m-d H:i:s.u', ]; - if (!isset($units[$unit])) { - if (isset($this->$unit)) { - return $this->resolveCarbon($date)->$unit === $this->$unit; - } - - if ($this->localStrictModeEnabled ?? static::isStrictModeEnabled()) { - throw new BadComparisonUnitException($unit); - } - - return false; + if (isset($units[$unit])) { + return $this->isSameAs($units[$unit], $date); } - return $this->isSameAs($units[$unit], $date); + if (isset($this->$unit)) { + return $this->resolveCarbon($date)->$unit === $this->$unit; + } + + if ($this->localStrictModeEnabled ?? static::isStrictModeEnabled()) { + throw new BadComparisonUnitException($unit); + } + + return false; } /** @@ -981,12 +1022,12 @@ trait Comparison return $current->startOfMinute()->eq($other); } - if (preg_match('/\d(h|am|pm)$/', $tester)) { + if (preg_match('/\d(?:h|am|pm)$/', $tester)) { return $current->startOfHour()->eq($other); } if (preg_match( - '/^(january|february|march|april|may|june|july|august|september|october|november|december)\s+\d+$/i', + '/^(?:january|february|march|april|may|june|july|august|september|october|november|december)(?:\s+\d+)?$/i', $tester )) { return $current->startOfMonth()->eq($other->startOfMonth()); @@ -1067,4 +1108,18 @@ trait Comparison { return $this->endOfTime ?? false; } + + private function discourageNull($value): void + { + if ($value === null) { + @trigger_error("Since 2.61.0, it's deprecated to compare a date to null, meaning of such comparison is ambiguous and will no longer be possible in 3.0.0, you should explicitly pass 'now' or make an other check to eliminate null values.", \E_USER_DEPRECATED); + } + } + + private function discourageBoolean($value): void + { + if (\is_bool($value)) { + @trigger_error("Since 2.61.0, it's deprecated to compare a date to true or false, meaning of such comparison is ambiguous and will no longer be possible in 3.0.0, you should explicitly pass 'now' or make an other check to eliminate boolean values.", \E_USER_DEPRECATED); + } + } } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Converter.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Converter.php index 8fe008a5c..fff8a600a 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Converter.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Converter.php @@ -16,6 +16,7 @@ use Carbon\CarbonImmutable; use Carbon\CarbonInterface; use Carbon\CarbonInterval; use Carbon\CarbonPeriod; +use Carbon\CarbonPeriodImmutable; use Carbon\Exceptions\UnitException; use Closure; use DateTime; @@ -34,39 +35,7 @@ use ReturnTypeWillChange; */ trait Converter { - /** - * Format to use for __toString method when type juggling occurs. - * - * @var string|Closure|null - */ - protected static $toStringFormat; - - /** - * Reset the format used to the default when type juggling a Carbon instance to a string - * - * @return void - */ - public static function resetToStringFormat() - { - static::setToStringFormat(null); - } - - /** - * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. - * You should rather let Carbon object being casted to string with DEFAULT_TO_STRING_FORMAT, and - * use other method or custom format passed to format() method if you need to dump an other string - * format. - * - * Set the default format used when type juggling a Carbon instance to a string - * - * @param string|Closure|null $format - * - * @return void - */ - public static function setToStringFormat($format) - { - static::$toStringFormat = $format; - } + use ToStringFormat; /** * Returns the formatted date string on success or FALSE on failure. @@ -110,7 +79,7 @@ trait Converter * * @example * ``` - * echo Carbon::now(); // Carbon instances can be casted to string + * echo Carbon::now(); // Carbon instances can be cast to string * ``` * * @return string @@ -158,6 +127,21 @@ trait Converter return $this->rawFormat('M j, Y'); } + /** + * Format the instance with the day, and a readable date + * + * @example + * ``` + * echo Carbon::now()->toFormattedDayDateString(); + * ``` + * + * @return string + */ + public function toFormattedDayDateString(): string + { + return $this->rawFormat('D, M j, Y'); + } + /** * Format the instance as time * @@ -622,16 +606,18 @@ trait Converter $interval = CarbonInterval::make("$interval ".static::pluralUnit($unit)); } - $period = (new CarbonPeriod())->setDateClass(static::class)->setStartDate($this); + $period = ($this->isMutable() ? new CarbonPeriod() : new CarbonPeriodImmutable()) + ->setDateClass(static::class) + ->setStartDate($this); if ($interval) { - $period->setDateInterval($interval); + $period = $period->setDateInterval($interval); } - if (\is_int($end) || \is_string($end) && ctype_digit($end)) { - $period->setRecurrences($end); + if (\is_int($end) || (\is_string($end) && ctype_digit($end))) { + $period = $period->setRecurrences($end); } elseif ($end) { - $period->setEndDate($end); + $period = $period->setEndDate($end); } return $period; diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php index f2adee5fd..0d611ea22 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php @@ -19,6 +19,8 @@ use Carbon\Exceptions\InvalidFormatException; use Carbon\Exceptions\OutOfRangeException; use Carbon\Translator; use Closure; +use DateMalformedStringException; +use DateTimeImmutable; use DateTimeInterface; use DateTimeZone; use Exception; @@ -79,8 +81,8 @@ trait Creator // Work-around for PHP bug https://bugs.php.net/bug.php?id=67127 if (!str_contains((string) .1, '.')) { - $locale = setlocale(LC_NUMERIC, '0'); - setlocale(LC_NUMERIC, 'C'); + $locale = setlocale(LC_NUMERIC, '0'); // @codeCoverageIgnore + setlocale(LC_NUMERIC, 'C'); // @codeCoverageIgnore } try { @@ -92,7 +94,7 @@ trait Creator $this->constructedObjectId = spl_object_hash($this); if (isset($locale)) { - setlocale(LC_NUMERIC, $locale); + setlocale(LC_NUMERIC, $locale); // @codeCoverageIgnore } self::setLastErrors(parent::getLastErrors()); @@ -112,7 +114,7 @@ trait Creator $safeTz = static::safeCreateDateTimeZone($tz); if ($safeTz) { - return $date->setTimezone($safeTz); + return ($date instanceof DateTimeImmutable ? $date : clone $date)->setTimezone($safeTz); } return $date; @@ -148,7 +150,7 @@ trait Creator $instance = new static($date->format('Y-m-d H:i:s.u'), $date->getTimezone()); - if ($date instanceof CarbonInterface || $date instanceof Options) { + if ($date instanceof CarbonInterface) { $settings = $date->getSettings(); if (!$date->hasLocalTranslator()) { @@ -184,7 +186,13 @@ trait Creator try { return new static($time, $tz); } catch (Exception $exception) { - $date = @static::now($tz)->change($time); + // @codeCoverageIgnoreStart + try { + $date = @static::now($tz)->change($time); + } catch (DateMalformedStringException $ignoredException) { + $date = null; + } + // @codeCoverageIgnoreEnd if (!$date) { throw new InvalidFormatException("Could not parse '$time': ".$exception->getMessage(), 0, $exception); @@ -354,13 +362,13 @@ trait Creator * If $hour is not null then the default values for $minute and $second * will be 0. * - * @param int|null $year - * @param int|null $month - * @param int|null $day - * @param int|null $hour - * @param int|null $minute - * @param int|null $second - * @param DateTimeZone|string|null $tz + * @param DateTimeInterface|int|null $year + * @param int|null $month + * @param int|null $day + * @param int|null $hour + * @param int|null $minute + * @param int|null $second + * @param DateTimeZone|string|null $tz * * @throws InvalidFormatException * @@ -368,7 +376,7 @@ trait Creator */ public static function create($year = 0, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0, $tz = null) { - if (\is_string($year) && !is_numeric($year) || $year instanceof DateTimeInterface) { + if ((\is_string($year) && !is_numeric($year)) || $year instanceof DateTimeInterface) { return static::parse($year, $tz ?: (\is_string($month) || $month instanceof DateTimeZone ? $month : null)); } @@ -634,6 +642,10 @@ trait Creator $time = preg_replace('/^(.*)(am|pm|AM|PM)(.*)$/U', '$1$3 $2', $time); } + if ($tz === false) { + $tz = null; + } + // First attempt to create an instance, so that error messages are based on the unmodified format. $date = self::createFromFormatAndTimezone($format, $time, $tz); $lastErrors = parent::getLastErrors(); @@ -651,12 +663,14 @@ trait Creator $tz = clone $mock->getTimezone(); } - // Set microseconds to zero to match behavior of DateTime::createFromFormat() - // See https://bugs.php.net/bug.php?id=74332 - $mock = $mock->copy()->microsecond(0); + $mock = $mock->copy(); // Prepend mock datetime only if the format does not contain non escaped unix epoch reset flag. if (!preg_match("/{$nonEscaped}[!|]/", $format)) { + if (preg_match('/[HhGgisvuB]/', $format)) { + $mock = $mock->setTime(0, 0); + } + $format = static::MOCK_DATETIME_FORMAT.' '.$format; $time = ($mock instanceof self ? $mock->rawFormat(static::MOCK_DATETIME_FORMAT) : $mock->format(static::MOCK_DATETIME_FORMAT)).' '.$time; } @@ -862,6 +876,19 @@ trait Creator */ public static function createFromLocaleFormat($format, $locale, $time, $tz = null) { + $format = preg_replace_callback( + '/(?:\\\\[a-zA-Z]|[bfkqCEJKQRV]){2,}/', + static function (array $match) use ($locale): string { + $word = str_replace('\\', '', $match[0]); + $translatedWord = static::translateTimeString($word, $locale, 'en'); + + return $word === $translatedWord + ? $match[0] + : preg_replace('/[a-zA-Z]/', '\\\\$0', $translatedWord); + }, + $format + ); + return static::rawCreateFromFormat($format, static::translateTimeString($time, $locale, 'en'), $tz); } @@ -907,9 +934,9 @@ trait Creator if (\is_string($var)) { $var = trim($var); - if (!preg_match('/^P[0-9T]/', $var) && - !preg_match('/^R[0-9]/', $var) && - preg_match('/[a-z0-9]/i', $var) + if (!preg_match('/^P[\dT]/', $var) && + !preg_match('/^R\d/', $var) && + preg_match('/[a-z\d]/i', $var) ) { $date = static::parse($var); } @@ -921,13 +948,20 @@ trait Creator /** * Set last errors. * - * @param array $lastErrors + * @param array|bool $lastErrors * * @return void */ - private static function setLastErrors(array $lastErrors) + private static function setLastErrors($lastErrors) { - static::$lastErrors = $lastErrors; + if (\is_array($lastErrors) || $lastErrors === false) { + static::$lastErrors = \is_array($lastErrors) ? $lastErrors : [ + 'warning_count' => 0, + 'warnings' => [], + 'error_count' => 0, + 'errors' => [], + ]; + } } /** diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Date.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Date.php index 8c8af6fb0..8ae5c1781 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Date.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Date.php @@ -532,6 +532,7 @@ trait Date use Creator; use Difference; use Macro; + use MagicParameter; use Modifiers; use Mutability; use ObjectInitialisation; @@ -641,9 +642,11 @@ trait Date /** * List of minimum and maximums for each unit. * + * @param int $daysInMonth + * * @return array */ - protected static function getRangesByUnit() + protected static function getRangesByUnit(int $daysInMonth = 31): array { return [ // @call roundUnit @@ -651,7 +654,7 @@ trait Date // @call roundUnit 'month' => [1, static::MONTHS_PER_YEAR], // @call roundUnit - 'day' => [1, 31], + 'day' => [1, $daysInMonth], // @call roundUnit 'hour' => [0, static::HOURS_PER_DAY - 1], // @call roundUnit @@ -940,7 +943,7 @@ trait Date case $name === 'millisecond': // @property int case $name === 'milli': - return (int) floor($this->rawFormat('u') / 1000); + return (int) floor(((int) $this->rawFormat('u')) / 1000); // @property int 1 through 53 case $name === 'week': @@ -1250,7 +1253,7 @@ trait Date protected function getTranslatedFormByRegExp($baseKey, $keySuffix, $context, $subKey, $defaultValue) { $key = $baseKey.$keySuffix; - $standaloneKey = "${key}_standalone"; + $standaloneKey = "{$key}_standalone"; $baseTranslation = $this->getTranslationMessage($key); if ($baseTranslation instanceof Closure) { @@ -1259,7 +1262,7 @@ trait Date if ( $this->getTranslationMessage("$standaloneKey.$subKey") && - (!$context || ($regExp = $this->getTranslationMessage("${baseKey}_regexp")) && !preg_match($regExp, $context)) + (!$context || (($regExp = $this->getTranslationMessage("{$baseKey}_regexp")) && !preg_match($regExp, $context))) ) { $key = $standaloneKey; } @@ -1354,9 +1357,14 @@ trait Date */ public function weekday($value = null) { - $dayOfWeek = ($this->dayOfWeek + 7 - (int) ($this->getTranslationMessage('first_day_of_week') ?? 0)) % 7; + if ($value === null) { + return $this->dayOfWeek; + } - return $value === null ? $dayOfWeek : $this->addDays($value - $dayOfWeek); + $firstDay = (int) ($this->getTranslationMessage('first_day_of_week') ?? 0); + $dayOfWeek = ($this->dayOfWeek + 7 - $firstDay) % 7; + + return $this->addDays((($value + 7 - $firstDay) % 7) - $dayOfWeek); } /** @@ -1373,6 +1381,39 @@ trait Date return $value === null ? $dayOfWeekIso : $this->addDays($value - $dayOfWeekIso); } + /** + * Return the number of days since the start of the week (using the current locale or the first parameter + * if explicitly given). + * + * @param int|null $weekStartsAt optional start allow you to specify the day of week to use to start the week, + * if not provided, start of week is inferred from the locale + * (Sunday for en_US, Monday for de_DE, etc.) + * + * @return int + */ + public function getDaysFromStartOfWeek(int $weekStartsAt = null): int + { + $firstDay = (int) ($weekStartsAt ?? $this->getTranslationMessage('first_day_of_week') ?? 0); + + return ($this->dayOfWeek + 7 - $firstDay) % 7; + } + + /** + * Set the day (keeping the current time) to the start of the week + the number of days passed as the first + * parameter. First day of week is driven by the locale unless explicitly set with the second parameter. + * + * @param int $numberOfDays number of days to add after the start of the current week + * @param int|null $weekStartsAt optional start allow you to specify the day of week to use to start the week, + * if not provided, start of week is inferred from the locale + * (Sunday for en_US, Monday for de_DE, etc.) + * + * @return static + */ + public function setDaysFromStartOfWeek(int $numberOfDays, int $weekStartsAt = null) + { + return $this->addDays($numberOfDays - $this->getDaysFromStartOfWeek($weekStartsAt)); + } + /** * Set any unit to a new value without overflowing current other unit given. * @@ -1848,9 +1889,18 @@ trait Date $format = preg_replace('#(?toDateTimeString())); + $time = strtotime($this->toDateTimeString()); + $formatted = ($this->localStrictModeEnabled ?? static::isStrictModeEnabled()) + ? strftime($format, $time) + : @strftime($format, $time); - return static::$utf8 ? utf8_encode($formatted) : $formatted; + return static::$utf8 + ? ( + \function_exists('mb_convert_encoding') + ? mb_convert_encoding($formatted, 'UTF-8', mb_list_encodings()) + : utf8_encode($formatted) + ) + : $formatted; } /** @@ -1869,6 +1919,10 @@ trait Date 'LL' => $this->getTranslationMessage('formats.LL', $locale, 'MMMM D, YYYY'), 'LLL' => $this->getTranslationMessage('formats.LLL', $locale, 'MMMM D, YYYY h:mm A'), 'LLLL' => $this->getTranslationMessage('formats.LLLL', $locale, 'dddd, MMMM D, YYYY h:mm A'), + 'l' => $this->getTranslationMessage('formats.l', $locale), + 'll' => $this->getTranslationMessage('formats.ll', $locale), + 'lll' => $this->getTranslationMessage('formats.lll', $locale), + 'llll' => $this->getTranslationMessage('formats.llll', $locale), ]; } @@ -2152,7 +2206,7 @@ trait Date $input = mb_substr($format, $i); - if (preg_match('/^(LTS|LT|[Ll]{1,4})/', $input, $match)) { + if (preg_match('/^(LTS|LT|l{1,4}|L{1,4})/', $input, $match)) { if ($formats === null) { $formats = $this->getIsoFormats(); } @@ -2256,6 +2310,7 @@ trait Date 'c' => true, 'r' => true, 'U' => true, + 'T' => true, ]; } @@ -2359,7 +2414,7 @@ trait Date $symbol = $second < 0 ? '-' : '+'; $minute = abs($second) / static::SECONDS_PER_MINUTE; $hour = str_pad((string) floor($minute / static::MINUTES_PER_HOUR), 2, '0', STR_PAD_LEFT); - $minute = str_pad((string) ($minute % static::MINUTES_PER_HOUR), 2, '0', STR_PAD_LEFT); + $minute = str_pad((string) (((int) $minute) % static::MINUTES_PER_HOUR), 2, '0', STR_PAD_LEFT); return "$symbol$hour$separator$minute"; } @@ -2479,7 +2534,7 @@ trait Date return 'millennia'; } - return "${unit}s"; + return "{$unit}s"; } protected function executeCallable($macro, ...$parameters) @@ -2566,7 +2621,7 @@ trait Date if (str_starts_with($unit, 'is')) { $word = substr($unit, 2); - if (\in_array($word, static::$days)) { + if (\in_array($word, static::$days, true)) { return $this->isDayOfWeek($word); } @@ -2594,7 +2649,7 @@ trait Date $unit = strtolower(substr($unit, 3)); } - if (\in_array($unit, static::$units)) { + if (\in_array($unit, static::$units, true)) { return $this->setUnit($unit, ...$parameters); } @@ -2604,7 +2659,7 @@ trait Date if (str_starts_with($unit, 'Real')) { $unit = static::singularUnit(substr($unit, 4)); - return $this->{"${action}RealUnit"}($unit, ...$parameters); + return $this->{"{$action}RealUnit"}($unit, ...$parameters); } if (preg_match('/^(Month|Quarter|Year|Decade|Century|Centurie|Millennium|Millennia)s?(No|With|Without|WithNo)Overflow$/', $unit, $match)) { @@ -2616,7 +2671,7 @@ trait Date } if (static::isModifiableUnit($unit)) { - return $this->{"${action}Unit"}($unit, $parameters[0] ?? 1, $overflow); + return $this->{"{$action}Unit"}($unit, $this->getMagicParameter($parameters, 0, 'value', 1), $overflow); } $sixFirstLetters = substr($unit, 0, 6); @@ -2655,7 +2710,11 @@ trait Date try { $unit = static::singularUnit(substr($method, 0, -5)); - return $this->range($parameters[0] ?? $this, $parameters[1] ?? 1, $unit); + return $this->range( + $this->getMagicParameter($parameters, 0, 'endDate', $this), + $this->getMagicParameter($parameters, 1, 'factor', 1), + $unit + ); } catch (InvalidArgumentException $exception) { // Try macros } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Difference.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Difference.php index cce1d2c3f..ab5b65d23 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Difference.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Difference.php @@ -83,9 +83,9 @@ trait Difference * * @return CarbonInterval */ - protected static function fixDiffInterval(DateInterval $diff, $absolute) + protected static function fixDiffInterval(DateInterval $diff, $absolute, array $skip = []) { - $diff = CarbonInterval::instance($diff); + $diff = CarbonInterval::instance($diff, $skip); // Work-around for https://bugs.php.net/bug.php?id=77145 // @codeCoverageIgnoreStart @@ -148,9 +148,9 @@ trait Difference * * @return CarbonInterval */ - public function diffAsCarbonInterval($date = null, $absolute = true) + public function diffAsCarbonInterval($date = null, $absolute = true, array $skip = []) { - return static::fixDiffInterval($this->diff($this->resolveCarbon($date), $absolute), $absolute); + return static::fixDiffInterval($this->diff($this->resolveCarbon($date), $absolute), $absolute, $skip); } /** @@ -189,9 +189,21 @@ trait Difference */ public function diffInMonths($date = null, $absolute = true) { - $date = $this->resolveCarbon($date); + $date = $this->resolveCarbon($date)->avoidMutation()->tz($this->tz); - return $this->diffInYears($date, $absolute) * static::MONTHS_PER_YEAR + (int) $this->diff($date, $absolute)->format('%r%m'); + [$yearStart, $monthStart, $dayStart] = explode('-', $this->format('Y-m-dHisu')); + [$yearEnd, $monthEnd, $dayEnd] = explode('-', $date->format('Y-m-dHisu')); + + $diff = (((int) $yearEnd) - ((int) $yearStart)) * static::MONTHS_PER_YEAR + + ((int) $monthEnd) - ((int) $monthStart); + + if ($diff > 0) { + $diff -= ($dayStart > $dayEnd ? 1 : 0); + } elseif ($diff < 0) { + $diff += ($dayStart < $dayEnd ? 1 : 0); + } + + return $absolute ? abs($diff) : $diff; } /** @@ -286,9 +298,9 @@ trait Difference */ public function diffInWeekdays($date = null, $absolute = true) { - return $this->diffInDaysFiltered(function (CarbonInterface $date) { + return $this->diffInDaysFiltered(static function (CarbonInterface $date) { return $date->isWeekday(); - }, $date, $absolute); + }, $this->resolveCarbon($date)->avoidMutation()->modify($this->format('H:i:s.u')), $absolute); } /** @@ -301,9 +313,9 @@ trait Difference */ public function diffInWeekendDays($date = null, $absolute = true) { - return $this->diffInDaysFiltered(function (CarbonInterface $date) { + return $this->diffInDaysFiltered(static function (CarbonInterface $date) { return $date->isWeekend(); - }, $date, $absolute); + }, $this->resolveCarbon($date)->avoidMutation()->modify($this->format('H:i:s.u')), $absolute); } /** @@ -472,7 +484,7 @@ trait Difference */ public function floatDiffInSeconds($date = null, $absolute = true) { - return $this->diffInMicroseconds($date, $absolute) / static::MICROSECONDS_PER_SECOND; + return (float) ($this->diffInMicroseconds($date, $absolute) / static::MICROSECONDS_PER_SECOND); } /** @@ -830,8 +842,9 @@ trait Difference $intSyntax = $intSyntax === static::DIFF_RELATIVE_AUTO && $other === null ? static::DIFF_RELATIVE_TO_NOW : $intSyntax; $parts = min(7, max(1, (int) $parts)); + $skip = \is_array($syntax) ? ($syntax['skip'] ?? []) : []; - return $this->diffAsCarbonInterval($other, false) + return $this->diffAsCarbonInterval($other, false, (array) $skip) ->setLocalTranslator($this->getLocalTranslator()) ->forHumans($syntax, (bool) $short, $parts, $options ?? $this->localHumanDiffOptions ?? static::getHumanDiffOptions()); } @@ -1161,7 +1174,7 @@ trait Difference version_compare(PHP_VERSION, '8.1.0-dev', '<') && abs($interval->d - $daysDiff) === 1 ) { - $daysDiff = abs($interval->d); + $daysDiff = abs($interval->d); // @codeCoverageIgnore } return $daysDiff * $sign; diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/IntervalRounding.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/IntervalRounding.php index 4cd66b676..f069c280d 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/IntervalRounding.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/IntervalRounding.php @@ -40,7 +40,7 @@ trait IntervalRounding $unit = 'second'; if ($precision instanceof DateInterval) { - $precision = (string) CarbonInterval::instance($precision); + $precision = (string) CarbonInterval::instance($precision, [], true); } if (\is_string($precision) && preg_match('/^\s*(?\d+)?\s*(?\w+)(?\W.*)?$/', $precision, $match)) { diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Localization.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Localization.php index ddd2b4e98..46aff113e 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Localization.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Localization.php @@ -23,12 +23,16 @@ use Symfony\Component\Translation\TranslatorInterface; use Symfony\Contracts\Translation\LocaleAwareInterface; use Symfony\Contracts\Translation\TranslatorInterface as ContractsTranslatorInterface; -if (!interface_exists('Symfony\\Component\\Translation\\TranslatorInterface')) { +// @codeCoverageIgnoreStart +if (interface_exists('Symfony\\Contracts\\Translation\\TranslatorInterface') && + !interface_exists('Symfony\\Component\\Translation\\TranslatorInterface') +) { class_alias( 'Symfony\\Contracts\\Translation\\TranslatorInterface', 'Symfony\\Component\\Translation\\TranslatorInterface' ); } +// @codeCoverageIgnoreEnd /** * Trait Localization. @@ -355,6 +359,13 @@ trait Localization $weekdays = $messages['weekdays'] ?? []; $meridiem = $messages['meridiem'] ?? ['AM', 'PM']; + if (isset($messages['ordinal_words'])) { + $timeString = self::replaceOrdinalWords( + $timeString, + $key === 'from' ? array_flip($messages['ordinal_words']) : $messages['ordinal_words'] + ); + } + if ($key === 'from') { foreach (['months', 'weekdays'] as $variable) { $list = $messages[$variable.'_standalone'] ?? null; @@ -454,7 +465,7 @@ trait Localization } } - $this->setLocalTranslator($translator); + $this->localTranslator = $translator; } return $this; @@ -555,17 +566,13 @@ trait Localization public static function localeHasShortUnits($locale) { return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { - return $newLocale && - ( - ($y = static::translateWith($translator, 'y')) !== 'y' && - $y !== static::translateWith($translator, 'year') - ) || ( - ($y = static::translateWith($translator, 'd')) !== 'd' && + return ($newLocale && (($y = static::translateWith($translator, 'y')) !== 'y' && $y !== static::translateWith($translator, 'year'))) || ( + ($y = static::translateWith($translator, 'd')) !== 'd' && $y !== static::translateWith($translator, 'day') - ) || ( - ($y = static::translateWith($translator, 'h')) !== 'h' && + ) || ( + ($y = static::translateWith($translator, 'h')) !== 'h' && $y !== static::translateWith($translator, 'hour') - ); + ); }); } @@ -734,7 +741,7 @@ trait Localization } if ($translator && !($translator instanceof LocaleAwareInterface || method_exists($translator, 'getLocale'))) { - throw new NotLocaleAwareException($translator); + throw new NotLocaleAwareException($translator); // @codeCoverageIgnore } return $translator; @@ -823,4 +830,11 @@ trait Localization return $list; } + + private static function replaceOrdinalWords(string $timeString, array $ordinalWords): string + { + return preg_replace_callback('/(? + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +/** + * Trait MagicParameter. + * + * Allows to retrieve parameter in magic calls by index or name. + */ +trait MagicParameter +{ + private function getMagicParameter(array $parameters, int $index, string $key, $default) + { + if (\array_key_exists($index, $parameters)) { + return $parameters[$index]; + } + + if (\array_key_exists($key, $parameters)) { + return $parameters[$key]; + } + + return $default; + } +} diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Mixin.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Mixin.php index 88b251df4..582245456 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Mixin.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Mixin.php @@ -11,6 +11,9 @@ namespace Carbon\Traits; +use Carbon\CarbonInterface; +use Carbon\CarbonInterval; +use Carbon\CarbonPeriod; use Closure; use Generator; use ReflectionClass; @@ -99,12 +102,13 @@ trait Mixin { $context = eval(self::getAnonymousClassCodeForTrait($trait)); $className = \get_class($context); + $baseClass = static::class; foreach (self::getMixableMethods($context) as $name) { $closureBase = Closure::fromCallable([$context, $name]); - static::macro($name, function () use ($closureBase, $className) { - /** @phpstan-ignore-next-line */ + static::macro($name, function (...$parameters) use ($closureBase, $className, $baseClass) { + $downContext = isset($this) ? ($this) : new $baseClass(); $context = isset($this) ? $this->cast($className) : new $className(); try { @@ -117,7 +121,48 @@ trait Mixin // in case of errors not converted into exceptions $closure = $closure ?: $closureBase; - return $closure(...\func_get_args()); + $result = $closure(...$parameters); + + if (!($result instanceof $className)) { + return $result; + } + + if ($downContext instanceof CarbonInterface && $result instanceof CarbonInterface) { + if ($context !== $result) { + $downContext = $downContext->copy(); + } + + return $downContext + ->setTimezone($result->getTimezone()) + ->modify($result->format('Y-m-d H:i:s.u')) + ->settings($result->getSettings()); + } + + if ($downContext instanceof CarbonInterval && $result instanceof CarbonInterval) { + if ($context !== $result) { + $downContext = $downContext->copy(); + } + + $downContext->copyProperties($result); + self::copyStep($downContext, $result); + self::copyNegativeUnits($downContext, $result); + + return $downContext->settings($result->getSettings()); + } + + if ($downContext instanceof CarbonPeriod && $result instanceof CarbonPeriod) { + if ($context !== $result) { + $downContext = $downContext->copy(); + } + + return $downContext + ->setDates($result->getStartDate(), $result->getEndDate()) + ->setRecurrences($result->getRecurrences()) + ->setOptions($result->getOptions()) + ->settings($result->getSettings()); + } + + return $result; }); } } @@ -151,22 +196,12 @@ trait Mixin protected static function bindMacroContext($context, callable $callable) { static::$macroContextStack[] = $context; - $exception = null; - $result = null; try { - $result = $callable(); - } catch (Throwable $throwable) { - $exception = $throwable; + return $callable(); + } finally { + array_pop(static::$macroContextStack); } - - array_pop(static::$macroContextStack); - - if ($exception) { - throw $exception; - } - - return $result; } /** diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Modifiers.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Modifiers.php index 164dbbd10..39343d8fa 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Modifiers.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Modifiers.php @@ -75,7 +75,7 @@ trait Modifiers * * @param string|int|null $modifier * - * @return static + * @return static|false */ public function next($modifier = null) { @@ -157,7 +157,7 @@ trait Modifiers * * @param string|int|null $modifier * - * @return static + * @return static|false */ public function previous($modifier = null) { @@ -451,7 +451,7 @@ trait Modifiers * * @param string $modifier * - * @return static + * @return static|false */ public function change($modifier) { diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Options.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Options.php index 0ddee8dd6..48f973977 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Options.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Options.php @@ -22,7 +22,7 @@ use Throwable; * * Depends on the following methods: * - * @method \Carbon\Carbon|\Carbon\CarbonImmutable shiftTimezone($timezone) Set the timezone + * @method static shiftTimezone($timezone) Set the timezone */ trait Options { @@ -422,7 +422,7 @@ trait Options foreach ($map as $property => $key) { $value = $this->$property ?? null; - if ($value !== null) { + if ($value !== null && ($key !== 'locale' || $value !== 'en' || $this->localTranslator)) { $settings[$key] = $value; } } @@ -437,11 +437,11 @@ trait Options */ public function __debugInfo() { - $infos = array_filter(get_object_vars($this), function ($var) { + $infos = array_filter(get_object_vars($this), static function ($var) { return $var; }); - foreach (['dumpProperties', 'constructedObjectId'] as $property) { + foreach (['dumpProperties', 'constructedObjectId', 'constructed'] as $property) { if (isset($infos[$property])) { unset($infos[$property]); } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Rounding.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Rounding.php index 33062397f..85ff5a711 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Rounding.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Rounding.php @@ -52,12 +52,11 @@ trait Rounding 'millisecond' => [1000, 'microsecond'], ]; $normalizedUnit = static::singularUnit($unit); - $ranges = array_merge(static::getRangesByUnit(), [ + $ranges = array_merge(static::getRangesByUnit($this->daysInMonth), [ // @call roundUnit 'microsecond' => [0, 999999], ]); $factor = 1; - $initialMonth = $this->month; if ($normalizedUnit === 'week') { $normalizedUnit = 'day'; @@ -77,12 +76,15 @@ trait Rounding $found = false; $fraction = 0; $arguments = null; + $initialValue = null; $factor = $this->year < 0 ? -1 : 1; $changes = []; + $minimumInc = null; foreach ($ranges as $unit => [$minimum, $maximum]) { if ($normalizedUnit === $unit) { $arguments = [$this->$unit, $minimum]; + $initialValue = $this->$unit; $fraction = $precision - floor($precision); $found = true; @@ -93,7 +95,23 @@ trait Rounding $delta = $maximum + 1 - $minimum; $factor /= $delta; $fraction *= $delta; - $arguments[0] += $this->$unit * $factor; + $inc = ($this->$unit - $minimum) * $factor; + + if ($inc !== 0.0) { + $minimumInc = $minimumInc ?? ($arguments[0] / pow(2, 52)); + + // If value is still the same when adding a non-zero increment/decrement, + // it means precision got lost in the addition + if (abs($inc) < $minimumInc) { + $inc = $minimumInc * ($inc < 0 ? -1 : 1); + } + + // If greater than $precision, assume precision loss caused an overflow + if ($function !== 'floor' || abs($arguments[0] + $inc - $initialValue) >= $precision) { + $arguments[0] += $inc; + } + } + $changes[$unit] = round( $minimum + ($fraction ? $fraction * $function(($this->$unit - $minimum) / $fraction) : 0) ); @@ -111,16 +129,13 @@ trait Rounding $normalizedValue = floor($function(($value - $minimum) / $precision) * $precision + $minimum); /** @var CarbonInterface $result */ - $result = $this->$normalizedUnit($normalizedValue); + $result = $this; foreach ($changes as $unit => $value) { $result = $result->$unit($value); } - return $normalizedUnit === 'month' && $precision <= 1 && abs($result->month - $initialMonth) === 2 - // Re-run the change in case an overflow occurred - ? $result->$normalizedUnit($normalizedValue) - : $result; + return $result->$normalizedUnit($normalizedValue); } /** diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Serialization.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Serialization.php index eebc69bd0..c1d5c5e13 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Serialization.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Serialization.php @@ -120,6 +120,8 @@ trait Serialization /** * Returns the list of properties to dump on serialize() called on. * + * Only used by PHP < 7.4. + * * @return array */ public function __sleep() @@ -134,22 +136,70 @@ trait Serialization return $properties; } + /** + * Returns the values to dump on serialize() called on. + * + * Only used by PHP >= 7.4. + * + * @return array + */ + public function __serialize(): array + { + // @codeCoverageIgnoreStart + if (isset($this->timezone_type, $this->timezone, $this->date)) { + return [ + 'date' => $this->date ?? null, + 'timezone_type' => $this->timezone_type, + 'timezone' => $this->timezone ?? null, + ]; + } + // @codeCoverageIgnoreEnd + + $timezone = $this->getTimezone(); + $export = [ + 'date' => $this->format('Y-m-d H:i:s.u'), + 'timezone_type' => $timezone->getType(), + 'timezone' => $timezone->getName(), + ]; + + // @codeCoverageIgnoreStart + if (\extension_loaded('msgpack') && isset($this->constructedObjectId)) { + $export['dumpDateProperties'] = [ + 'date' => $this->format('Y-m-d H:i:s.u'), + 'timezone' => serialize($this->timezone ?? null), + ]; + } + // @codeCoverageIgnoreEnd + + if ($this->localTranslator ?? null) { + $export['dumpLocale'] = $this->locale ?? null; + } + + return $export; + } + /** * Set locale if specified on unserialize() called. * + * Only used by PHP < 7.4. + * * @return void */ #[ReturnTypeWillChange] public function __wakeup() { - if (get_parent_class() && method_exists(parent::class, '__wakeup')) { + if (parent::class && method_exists(parent::class, '__wakeup')) { // @codeCoverageIgnoreStart try { parent::__wakeup(); } catch (Throwable $exception) { - // FatalError occurs when calling msgpack_unpack() in PHP 7.4 or later. - ['date' => $date, 'timezone' => $timezone] = $this->dumpDateProperties; - parent::__construct($date, unserialize($timezone)); + try { + // FatalError occurs when calling msgpack_unpack() in PHP 7.4 or later. + ['date' => $date, 'timezone' => $timezone] = $this->dumpDateProperties; + parent::__construct($date, unserialize($timezone)); + } catch (Throwable $ignoredException) { + throw $exception; + } } // @codeCoverageIgnoreEnd } @@ -164,6 +214,38 @@ trait Serialization $this->cleanupDumpProperties(); } + /** + * Set locale if specified on unserialize() called. + * + * Only used by PHP >= 7.4. + * + * @return void + */ + public function __unserialize(array $data): void + { + // @codeCoverageIgnoreStart + try { + $this->__construct($data['date'] ?? null, $data['timezone'] ?? null); + } catch (Throwable $exception) { + if (!isset($data['dumpDateProperties']['date'], $data['dumpDateProperties']['timezone'])) { + throw $exception; + } + + try { + // FatalError occurs when calling msgpack_unpack() in PHP 7.4 or later. + ['date' => $date, 'timezone' => $timezone] = $data['dumpDateProperties']; + $this->__construct($date, unserialize($timezone)); + } catch (Throwable $ignoredException) { + throw $exception; + } + } + // @codeCoverageIgnoreEnd + + if (isset($data['dumpLocale'])) { + $this->locale($data['dumpLocale']); + } + } + /** * Prepare the object for JSON serialization. * @@ -207,11 +289,15 @@ trait Serialization */ public function cleanupDumpProperties() { - foreach ($this->dumpProperties as $property) { - if (isset($this->$property)) { - unset($this->$property); + // @codeCoverageIgnoreStart + if (PHP_VERSION < 8.2) { + foreach ($this->dumpProperties as $property) { + if (isset($this->$property)) { + unset($this->$property); + } } } + // @codeCoverageIgnoreEnd return $this; } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Test.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Test.php index c86faa74c..f23c72e8f 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Test.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Test.php @@ -28,7 +28,7 @@ trait Test /** * A test Carbon instance to be returned when now instances are created. * - * @var static + * @var Closure|static|null */ protected static $testNow; @@ -59,15 +59,13 @@ trait Test * * /!\ Use this method for unit tests only. * - * @param Closure|static|string|false|null $testNow real or mock Carbon instance + * @param DateTimeInterface|Closure|static|string|false|null $testNow real or mock Carbon instance */ public static function setTestNow($testNow = null) { - if ($testNow === false) { - $testNow = null; - } - - static::$testNow = \is_string($testNow) ? static::parse($testNow) : $testNow; + static::$testNow = $testNow instanceof self || $testNow instanceof Closure + ? $testNow + : static::make($testNow); } /** @@ -87,7 +85,7 @@ trait Test * * /!\ Use this method for unit tests only. * - * @param Closure|static|string|false|null $testNow real or mock Carbon instance + * @param DateTimeInterface|Closure|static|string|false|null $testNow real or mock Carbon instance */ public static function setTestNowAndTimezone($testNow = null, $tz = null) { @@ -121,16 +119,22 @@ trait Test * * /!\ Use this method for unit tests only. * - * @param Closure|static|string|false|null $testNow real or mock Carbon instance - * @param Closure|null $callback + * @template T * - * @return mixed + * @param DateTimeInterface|Closure|static|string|false|null $testNow real or mock Carbon instance + * @param Closure(): T $callback + * + * @return T */ - public static function withTestNow($testNow = null, $callback = null) + public static function withTestNow($testNow, $callback) { static::setTestNow($testNow); - $result = $callback(); - static::setTestNow(); + + try { + $result = $callback(); + } finally { + static::setTestNow(); + } return $result; } diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Timestamp.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Timestamp.php index 2cb5c48d7..88a465c93 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Timestamp.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Timestamp.php @@ -63,7 +63,7 @@ trait Timestamp public static function createFromTimestampMsUTC($timestamp) { [$milliseconds, $microseconds] = self::getIntegerAndDecimalParts($timestamp, 3); - $sign = $milliseconds < 0 || $milliseconds === 0.0 && $microseconds < 0 ? -1 : 1; + $sign = $milliseconds < 0 || ($milliseconds === 0.0 && $microseconds < 0) ? -1 : 1; $milliseconds = abs($milliseconds); $microseconds = $sign * abs($microseconds) + static::MICROSECONDS_PER_MILLISECOND * ($milliseconds % static::MILLISECONDS_PER_SECOND); $seconds = $sign * floor($milliseconds / static::MILLISECONDS_PER_SECOND); @@ -125,7 +125,7 @@ trait Timestamp */ public function getPreciseTimestamp($precision = 6) { - return round($this->rawFormat('Uu') / pow(10, 6 - $precision)); + return round(((float) $this->rawFormat('Uu')) / pow(10, 6 - $precision)); } /** @@ -182,7 +182,7 @@ trait Timestamp $integer = 0; $decimal = 0; - foreach (preg_split('`[^0-9.]+`', $numbers) as $chunk) { + foreach (preg_split('`[^\d.]+`', $numbers) as $chunk) { [$integerPart, $decimalPart] = explode('.', "$chunk."); $integer += (int) $integerPart; diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/ToStringFormat.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/ToStringFormat.php new file mode 100644 index 000000000..a81164f99 --- /dev/null +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/ToStringFormat.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon\Traits; + +use Closure; + +/** + * Trait ToStringFormat. + * + * Handle global format customization for string cast of the object. + */ +trait ToStringFormat +{ + /** + * Format to use for __toString method when type juggling occurs. + * + * @var string|Closure|null + */ + protected static $toStringFormat; + + /** + * Reset the format used to the default when type juggling a Carbon instance to a string + * + * @return void + */ + public static function resetToStringFormat() + { + static::setToStringFormat(null); + } + + /** + * @deprecated To avoid conflict between different third-party libraries, static setters should not be used. + * You should rather let Carbon object being cast to string with DEFAULT_TO_STRING_FORMAT, and + * use other method or custom format passed to format() method if you need to dump another string + * format. + * + * Set the default format used when type juggling a Carbon instance to a string. + * + * @param string|Closure|null $format + * + * @return void + */ + public static function setToStringFormat($format) + { + static::$toStringFormat = $format; + } +} diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Units.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Units.php index 2902a8b10..5be14ec7e 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Units.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/Traits/Units.php @@ -17,6 +17,7 @@ use Carbon\CarbonInterval; use Carbon\Exceptions\UnitException; use Closure; use DateInterval; +use DateMalformedStringException; use ReturnTypeWillChange; /** @@ -60,8 +61,6 @@ trait Units case 'millisecond': return $this->addRealUnit('microsecond', $value * static::MICROSECONDS_PER_MILLISECOND); - break; - // @call addRealUnit case 'second': break; @@ -167,7 +166,7 @@ trait Units 'weekday', ]; - return \in_array($unit, $modifiableUnits) || \in_array($unit, static::$units); + return \in_array($unit, $modifiableUnits, true) || \in_array($unit, static::$units, true); } /** @@ -199,7 +198,7 @@ trait Units public function add($unit, $value = 1, $overflow = null) { if (\is_string($unit) && \func_num_args() === 1) { - $unit = CarbonInterval::make($unit); + $unit = CarbonInterval::make($unit, [], true); } if ($unit instanceof CarbonConverterInterface) { @@ -232,6 +231,8 @@ trait Units */ public function addUnit($unit, $value = 1, $overflow = null) { + $originalArgs = \func_get_args(); + $date = $this; if (!is_numeric($value) || !(float) $value) { @@ -264,7 +265,7 @@ trait Units /** @var static $date */ $date = $date->addDays($sign); - while (\in_array($date->dayOfWeek, $weekendDays)) { + while (\in_array($date->dayOfWeek, $weekendDays, true)) { $date = $date->addDays($sign); } } @@ -274,14 +275,14 @@ trait Units } $timeString = $date->toTimeString(); - } elseif ($canOverflow = \in_array($unit, [ + } elseif ($canOverflow = (\in_array($unit, [ 'month', 'year', ]) && ($overflow === false || ( $overflow === null && ($ucUnit = ucfirst($unit).'s') && !($this->{'local'.$ucUnit.'Overflow'} ?? static::{'shouldOverflow'.$ucUnit}()) - ))) { + )))) { $day = $date->day; } @@ -304,16 +305,21 @@ trait Units $unit = 'second'; $value = $second; } - $date = $date->modify("$value $unit"); - if (isset($timeString)) { - $date = $date->setTimeFromTimeString($timeString); - } elseif (isset($canOverflow, $day) && $canOverflow && $day !== $date->day) { - $date = $date->modify('last day of previous month'); + try { + $date = $date->modify("$value $unit"); + + if (isset($timeString)) { + $date = $date->setTimeFromTimeString($timeString); + } elseif (isset($canOverflow, $day) && $canOverflow && $day !== $date->day) { + $date = $date->modify('last day of previous month'); + } + } catch (DateMalformedStringException $ignoredException) { // @codeCoverageIgnore + $date = null; // @codeCoverageIgnore } if (!$date) { - throw new UnitException('Unable to add unit '.var_export(\func_get_args(), true)); + throw new UnitException('Unable to add unit '.var_export($originalArgs, true)); } return $date; @@ -362,7 +368,7 @@ trait Units public function sub($unit, $value = 1, $overflow = null) { if (\is_string($unit) && \func_num_args() === 1) { - $unit = CarbonInterval::make($unit); + $unit = CarbonInterval::make($unit, [], true); } if ($unit instanceof CarbonConverterInterface) { @@ -398,7 +404,7 @@ trait Units public function subtract($unit, $value = 1, $overflow = null) { if (\is_string($unit) && \func_num_args() === 1) { - $unit = CarbonInterval::make($unit); + $unit = CarbonInterval::make($unit, [], true); } return $this->sub($unit, $value, $overflow); diff --git a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/TranslatorImmutable.php b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/TranslatorImmutable.php index ad36c6704..ce6b2f90a 100644 --- a/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/TranslatorImmutable.php +++ b/data/web/inc/lib/vendor/nesbot/carbon/src/Carbon/TranslatorImmutable.php @@ -66,7 +66,7 @@ class TranslatorImmutable extends Translator /** * @codeCoverageIgnore */ - public function setConfigCacheFactory(ConfigCacheFactoryInterface $configCacheFactory) + public function setConfigCacheFactory(ConfigCacheFactoryInterface $configCacheFactory): void { $this->disallowMutation(__METHOD__); diff --git a/data/web/inc/lib/vendor/psr/clock/CHANGELOG.md b/data/web/inc/lib/vendor/psr/clock/CHANGELOG.md new file mode 100644 index 000000000..3cd6b9b75 --- /dev/null +++ b/data/web/inc/lib/vendor/psr/clock/CHANGELOG.md @@ -0,0 +1,11 @@ +# Changelog + +All notable changes to this project will be documented in this file, in reverse chronological order by release. + +## 1.0.0 + +First stable release after PSR-20 acceptance + +## 0.1.0 + +First release diff --git a/data/web/inc/lib/vendor/psr/clock/LICENSE b/data/web/inc/lib/vendor/psr/clock/LICENSE new file mode 100644 index 000000000..be6834212 --- /dev/null +++ b/data/web/inc/lib/vendor/psr/clock/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2017 PHP Framework Interoperability Group + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/data/web/inc/lib/vendor/psr/clock/README.md b/data/web/inc/lib/vendor/psr/clock/README.md new file mode 100644 index 000000000..6ca877eeb --- /dev/null +++ b/data/web/inc/lib/vendor/psr/clock/README.md @@ -0,0 +1,61 @@ +# PSR Clock + +This repository holds the interface for [PSR-20][psr-url]. + +Note that this is not a clock of its own. It is merely an interface that +describes a clock. See the specification for more details. + +## Installation + +```bash +composer require psr/clock +``` + +## Usage + +If you need a clock, you can use the interface like this: + +```php +clock = $clock; + } + + public function doSomething() + { + /** @var DateTimeImmutable $currentDateAndTime */ + $currentDateAndTime = $this->clock->now(); + // do something useful with that information + } +} +``` + +You can then pick one of the [implementations][implementation-url] of the interface to get a clock. + +If you want to implement the interface, you can require this package and +implement `Psr\Clock\ClockInterface` in your code. + +Don't forget to add `psr/clock-implementation` to your `composer.json`s `provides`-section like this: + +```json +{ + "provides": { + "psr/clock-implementation": "1.0" + } +} +``` + +And please read the [specification text][specification-url] for details on the interface. + +[psr-url]: https://www.php-fig.org/psr/psr-20 +[package-url]: https://packagist.org/packages/psr/clock +[implementation-url]: https://packagist.org/providers/psr/clock-implementation +[specification-url]: https://github.com/php-fig/fig-standards/blob/master/proposed/clock.md diff --git a/data/web/inc/lib/vendor/psr/clock/composer.json b/data/web/inc/lib/vendor/psr/clock/composer.json new file mode 100644 index 000000000..77992eda7 --- /dev/null +++ b/data/web/inc/lib/vendor/psr/clock/composer.json @@ -0,0 +1,21 @@ +{ + "name": "psr/clock", + "description": "Common interface for reading the clock.", + "keywords": ["psr", "psr-20", "time", "clock", "now"], + "homepage": "https://github.com/php-fig/clock", + "license": "MIT", + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "require": { + "php": "^7.0 || ^8.0" + }, + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + } +} diff --git a/data/web/inc/lib/vendor/psr/clock/src/ClockInterface.php b/data/web/inc/lib/vendor/psr/clock/src/ClockInterface.php new file mode 100644 index 000000000..7b6d8d8aa --- /dev/null +++ b/data/web/inc/lib/vendor/psr/clock/src/ClockInterface.php @@ -0,0 +1,13 @@ + 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4]; @@ -265,7 +265,7 @@ final class Mbstring return $result; } - return \iconv('UTF-8', $encoding.'//IGNORE', $result); + return iconv('UTF-8', $encoding.'//IGNORE', $result); } public static function mb_convert_case($s, $mode, $encoding = null) @@ -280,10 +280,10 @@ final class Mbstring if ('UTF-8' === $encoding) { $encoding = null; if (!preg_match('//u', $s)) { - $s = @\iconv('UTF-8', 'UTF-8//IGNORE', $s); + $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s); } } else { - $s = \iconv($encoding, 'UTF-8//IGNORE', $s); + $s = iconv($encoding, 'UTF-8//IGNORE', $s); } if (\MB_CASE_TITLE == $mode) { @@ -301,7 +301,11 @@ final class Mbstring $map = $upper; } else { if (self::MB_CASE_FOLD === $mode) { - $s = str_replace(self::CASE_FOLD[0], self::CASE_FOLD[1], $s); + static $caseFolding = null; + if (null === $caseFolding) { + $caseFolding = self::getData('caseFolding'); + } + $s = strtr($s, $caseFolding); } static $lower = null; @@ -343,7 +347,7 @@ final class Mbstring return $s; } - return \iconv('UTF-8', $encoding.'//IGNORE', $s); + return iconv('UTF-8', $encoding.'//IGNORE', $s); } public static function mb_internal_encoding($encoding = null) @@ -354,7 +358,7 @@ final class Mbstring $normalizedEncoding = self::getEncoding($encoding); - if ('UTF-8' === $normalizedEncoding || false !== @\iconv($normalizedEncoding, $normalizedEncoding, ' ')) { + if ('UTF-8' === $normalizedEncoding || false !== @iconv($normalizedEncoding, $normalizedEncoding, ' ')) { self::$internalEncoding = $normalizedEncoding; return true; @@ -406,6 +410,12 @@ final class Mbstring public static function mb_check_encoding($var = null, $encoding = null) { + if (PHP_VERSION_ID < 70200 && \is_array($var)) { + trigger_error('mb_check_encoding() expects parameter 1 to be string, array given', \E_USER_WARNING); + + return null; + } + if (null === $encoding) { if (null === $var) { return false; @@ -413,7 +423,21 @@ final class Mbstring $encoding = self::$internalEncoding; } - return self::mb_detect_encoding($var, [$encoding]) || false !== @\iconv($encoding, $encoding, $var); + if (!\is_array($var)) { + return self::mb_detect_encoding($var, [$encoding]) || false !== @iconv($encoding, $encoding, $var); + } + + foreach ($var as $key => $value) { + if (!self::mb_check_encoding($key, $encoding)) { + return false; + } + if (!self::mb_check_encoding($value, $encoding)) { + return false; + } + } + + return true; + } public static function mb_detect_encoding($str, $encodingList = null, $strict = false) @@ -488,7 +512,7 @@ final class Mbstring return \strlen($s); } - return @\iconv_strlen($s, $encoding); + return @iconv_strlen($s, $encoding); } public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null) @@ -509,7 +533,7 @@ final class Mbstring return 0; } - return \iconv_strpos($haystack, $needle, $offset, $encoding); + return iconv_strpos($haystack, $needle, $offset, $encoding); } public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) @@ -533,7 +557,7 @@ final class Mbstring } $pos = '' !== $needle || 80000 > \PHP_VERSION_ID - ? \iconv_strrpos($haystack, $needle, $encoding) + ? iconv_strrpos($haystack, $needle, $encoding) : self::mb_strlen($haystack, $encoding); return false !== $pos ? $offset + $pos : false; @@ -541,7 +565,7 @@ final class Mbstring public static function mb_str_split($string, $split_length = 1, $encoding = null) { - if (null !== $string && !is_scalar($string) && !(\is_object($string) && method_exists($string, '__toString'))) { + if (null !== $string && !\is_scalar($string) && !(\is_object($string) && method_exists($string, '__toString'))) { trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', \E_USER_WARNING); return null; @@ -550,6 +574,7 @@ final class Mbstring if (1 > $split_length = (int) $split_length) { if (80000 > \PHP_VERSION_ID) { trigger_error('The length of each segment must be greater than zero', \E_USER_WARNING); + return false; } @@ -568,7 +593,7 @@ final class Mbstring } $rx .= '.{'.$split_length.'})/us'; - return preg_split($rx, $string, null, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY); + return preg_split($rx, $string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY); } $result = []; @@ -617,7 +642,7 @@ final class Mbstring } if ($start < 0) { - $start = \iconv_strlen($s, $encoding) + $start; + $start = iconv_strlen($s, $encoding) + $start; if ($start < 0) { $start = 0; } @@ -626,19 +651,21 @@ final class Mbstring if (null === $length) { $length = 2147483647; } elseif ($length < 0) { - $length = \iconv_strlen($s, $encoding) + $length - $start; + $length = iconv_strlen($s, $encoding) + $length - $start; if ($length < 0) { return ''; } } - return (string) \iconv_substr($s, $start, $length, $encoding); + return (string) iconv_substr($s, $start, $length, $encoding); } public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null) { - $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding); - $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding); + [$haystack, $needle] = str_replace(self::SIMPLE_CASE_FOLD[0], self::SIMPLE_CASE_FOLD[1], [ + self::mb_convert_case($haystack, \MB_CASE_LOWER, $encoding), + self::mb_convert_case($needle, \MB_CASE_LOWER, $encoding), + ]); return self::mb_strpos($haystack, $needle, $offset, $encoding); } @@ -657,7 +684,7 @@ final class Mbstring $pos = strrpos($haystack, $needle); } else { $needle = self::mb_substr($needle, 0, 1, $encoding); - $pos = \iconv_strrpos($haystack, $needle, $encoding); + $pos = iconv_strrpos($haystack, $needle, $encoding); } return self::getSubpart($pos, $part, $haystack, $encoding); @@ -673,8 +700,11 @@ final class Mbstring public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null) { - $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding); - $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding); + $haystack = self::mb_convert_case($haystack, \MB_CASE_LOWER, $encoding); + $needle = self::mb_convert_case($needle, \MB_CASE_LOWER, $encoding); + + $haystack = str_replace(self::SIMPLE_CASE_FOLD[0], self::SIMPLE_CASE_FOLD[1], $haystack); + $needle = str_replace(self::SIMPLE_CASE_FOLD[0], self::SIMPLE_CASE_FOLD[1], $needle); return self::mb_strrpos($haystack, $needle, $offset, $encoding); } @@ -736,12 +766,12 @@ final class Mbstring $encoding = self::getEncoding($encoding); if ('UTF-8' !== $encoding) { - $s = \iconv($encoding, 'UTF-8//IGNORE', $s); + $s = iconv($encoding, 'UTF-8//IGNORE', $s); } $s = preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $s, -1, $wide); - return ($wide << 1) + \iconv_strlen($s, 'UTF-8'); + return ($wide << 1) + iconv_strlen($s, 'UTF-8'); } public static function mb_substr_count($haystack, $needle, $encoding = null) @@ -797,6 +827,50 @@ final class Mbstring return $code; } + public static function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = \STR_PAD_RIGHT, string $encoding = null): string + { + if (!\in_array($pad_type, [\STR_PAD_RIGHT, \STR_PAD_LEFT, \STR_PAD_BOTH], true)) { + throw new \ValueError('mb_str_pad(): Argument #4 ($pad_type) must be STR_PAD_LEFT, STR_PAD_RIGHT, or STR_PAD_BOTH'); + } + + if (null === $encoding) { + $encoding = self::mb_internal_encoding(); + } + + try { + $validEncoding = @self::mb_check_encoding('', $encoding); + } catch (\ValueError $e) { + throw new \ValueError(sprintf('mb_str_pad(): Argument #5 ($encoding) must be a valid encoding, "%s" given', $encoding)); + } + + // BC for PHP 7.3 and lower + if (!$validEncoding) { + throw new \ValueError(sprintf('mb_str_pad(): Argument #5 ($encoding) must be a valid encoding, "%s" given', $encoding)); + } + + if (self::mb_strlen($pad_string, $encoding) <= 0) { + throw new \ValueError('mb_str_pad(): Argument #3 ($pad_string) must be a non-empty string'); + } + + $paddingRequired = $length - self::mb_strlen($string, $encoding); + + if ($paddingRequired < 1) { + return $string; + } + + switch ($pad_type) { + case \STR_PAD_LEFT: + return self::mb_substr(str_repeat($pad_string, $paddingRequired), 0, $paddingRequired, $encoding).$string; + case \STR_PAD_RIGHT: + return $string.self::mb_substr(str_repeat($pad_string, $paddingRequired), 0, $paddingRequired, $encoding); + default: + $leftPaddingLength = floor($paddingRequired / 2); + $rightPaddingLength = $paddingRequired - $leftPaddingLength; + + return self::mb_substr(str_repeat($pad_string, $leftPaddingLength), 0, $leftPaddingLength, $encoding).$string.self::mb_substr(str_repeat($pad_string, $rightPaddingLength), 0, $rightPaddingLength, $encoding); + } + } + private static function getSubpart($pos, $part, $haystack, $encoding) { if (false === $pos) { diff --git a/data/web/inc/lib/vendor/symfony/polyfill-mbstring/README.md b/data/web/inc/lib/vendor/symfony/polyfill-mbstring/README.md index 4efb599d8..478b40da2 100644 --- a/data/web/inc/lib/vendor/symfony/polyfill-mbstring/README.md +++ b/data/web/inc/lib/vendor/symfony/polyfill-mbstring/README.md @@ -5,7 +5,7 @@ This component provides a partial, native PHP implementation for the [Mbstring](https://php.net/mbstring) extension. More information can be found in the -[main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md). +[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md). License ======= diff --git a/data/web/inc/lib/vendor/symfony/polyfill-mbstring/Resources/unidata/caseFolding.php b/data/web/inc/lib/vendor/symfony/polyfill-mbstring/Resources/unidata/caseFolding.php new file mode 100644 index 000000000..512bba0bf --- /dev/null +++ b/data/web/inc/lib/vendor/symfony/polyfill-mbstring/Resources/unidata/caseFolding.php @@ -0,0 +1,119 @@ + 'i̇', + 'µ' => 'μ', + 'ſ' => 's', + 'ͅ' => 'ι', + 'ς' => 'σ', + 'ϐ' => 'β', + 'ϑ' => 'θ', + 'ϕ' => 'φ', + 'ϖ' => 'π', + 'ϰ' => 'κ', + 'ϱ' => 'ρ', + 'ϵ' => 'ε', + 'ẛ' => 'ṡ', + 'ι' => 'ι', + 'ß' => 'ss', + 'ʼn' => 'ʼn', + 'ǰ' => 'ǰ', + 'ΐ' => 'ΐ', + 'ΰ' => 'ΰ', + 'և' => 'եւ', + 'ẖ' => 'ẖ', + 'ẗ' => 'ẗ', + 'ẘ' => 'ẘ', + 'ẙ' => 'ẙ', + 'ẚ' => 'aʾ', + 'ẞ' => 'ss', + 'ὐ' => 'ὐ', + 'ὒ' => 'ὒ', + 'ὔ' => 'ὔ', + 'ὖ' => 'ὖ', + 'ᾀ' => 'ἀι', + 'ᾁ' => 'ἁι', + 'ᾂ' => 'ἂι', + 'ᾃ' => 'ἃι', + 'ᾄ' => 'ἄι', + 'ᾅ' => 'ἅι', + 'ᾆ' => 'ἆι', + 'ᾇ' => 'ἇι', + 'ᾈ' => 'ἀι', + 'ᾉ' => 'ἁι', + 'ᾊ' => 'ἂι', + 'ᾋ' => 'ἃι', + 'ᾌ' => 'ἄι', + 'ᾍ' => 'ἅι', + 'ᾎ' => 'ἆι', + 'ᾏ' => 'ἇι', + 'ᾐ' => 'ἠι', + 'ᾑ' => 'ἡι', + 'ᾒ' => 'ἢι', + 'ᾓ' => 'ἣι', + 'ᾔ' => 'ἤι', + 'ᾕ' => 'ἥι', + 'ᾖ' => 'ἦι', + 'ᾗ' => 'ἧι', + 'ᾘ' => 'ἠι', + 'ᾙ' => 'ἡι', + 'ᾚ' => 'ἢι', + 'ᾛ' => 'ἣι', + 'ᾜ' => 'ἤι', + 'ᾝ' => 'ἥι', + 'ᾞ' => 'ἦι', + 'ᾟ' => 'ἧι', + 'ᾠ' => 'ὠι', + 'ᾡ' => 'ὡι', + 'ᾢ' => 'ὢι', + 'ᾣ' => 'ὣι', + 'ᾤ' => 'ὤι', + 'ᾥ' => 'ὥι', + 'ᾦ' => 'ὦι', + 'ᾧ' => 'ὧι', + 'ᾨ' => 'ὠι', + 'ᾩ' => 'ὡι', + 'ᾪ' => 'ὢι', + 'ᾫ' => 'ὣι', + 'ᾬ' => 'ὤι', + 'ᾭ' => 'ὥι', + 'ᾮ' => 'ὦι', + 'ᾯ' => 'ὧι', + 'ᾲ' => 'ὰι', + 'ᾳ' => 'αι', + 'ᾴ' => 'άι', + 'ᾶ' => 'ᾶ', + 'ᾷ' => 'ᾶι', + 'ᾼ' => 'αι', + 'ῂ' => 'ὴι', + 'ῃ' => 'ηι', + 'ῄ' => 'ήι', + 'ῆ' => 'ῆ', + 'ῇ' => 'ῆι', + 'ῌ' => 'ηι', + 'ῒ' => 'ῒ', + 'ῖ' => 'ῖ', + 'ῗ' => 'ῗ', + 'ῢ' => 'ῢ', + 'ῤ' => 'ῤ', + 'ῦ' => 'ῦ', + 'ῧ' => 'ῧ', + 'ῲ' => 'ὼι', + 'ῳ' => 'ωι', + 'ῴ' => 'ώι', + 'ῶ' => 'ῶ', + 'ῷ' => 'ῶι', + 'ῼ' => 'ωι', + 'ff' => 'ff', + 'fi' => 'fi', + 'fl' => 'fl', + 'ffi' => 'ffi', + 'ffl' => 'ffl', + 'ſt' => 'st', + 'st' => 'st', + 'ﬓ' => 'մն', + 'ﬔ' => 'մե', + 'ﬕ' => 'մի', + 'ﬖ' => 'վն', + 'ﬗ' => 'մխ', +]; diff --git a/data/web/inc/lib/vendor/symfony/polyfill-mbstring/bootstrap.php b/data/web/inc/lib/vendor/symfony/polyfill-mbstring/bootstrap.php index 1fedd1f7c..ecf1a0352 100644 --- a/data/web/inc/lib/vendor/symfony/polyfill-mbstring/bootstrap.php +++ b/data/web/inc/lib/vendor/symfony/polyfill-mbstring/bootstrap.php @@ -132,6 +132,10 @@ if (!function_exists('mb_str_split')) { function mb_str_split($string, $length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $length, $encoding); } } +if (!function_exists('mb_str_pad')) { + function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT, ?string $encoding = null): string { return p\Mbstring::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); } +} + if (extension_loaded('mbstring')) { return; } diff --git a/data/web/inc/lib/vendor/symfony/polyfill-mbstring/bootstrap80.php b/data/web/inc/lib/vendor/symfony/polyfill-mbstring/bootstrap80.php index 82f5ac4d0..2f9fb5b42 100644 --- a/data/web/inc/lib/vendor/symfony/polyfill-mbstring/bootstrap80.php +++ b/data/web/inc/lib/vendor/symfony/polyfill-mbstring/bootstrap80.php @@ -128,6 +128,10 @@ if (!function_exists('mb_str_split')) { function mb_str_split(?string $string, ?int $length = 1, ?string $encoding = null): array { return p\Mbstring::mb_str_split((string) $string, (int) $length, $encoding); } } +if (!function_exists('mb_str_pad')) { + function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT, ?string $encoding = null): string { return p\Mbstring::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); } +} + if (extension_loaded('mbstring')) { return; } diff --git a/data/web/inc/lib/vendor/symfony/polyfill-mbstring/composer.json b/data/web/inc/lib/vendor/symfony/polyfill-mbstring/composer.json index 1fa21ca16..bd99d4b9d 100644 --- a/data/web/inc/lib/vendor/symfony/polyfill-mbstring/composer.json +++ b/data/web/inc/lib/vendor/symfony/polyfill-mbstring/composer.json @@ -30,9 +30,6 @@ }, "minimum-stability": "dev", "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" diff --git a/data/web/inc/lib/vendor/symfony/polyfill-php80/LICENSE b/data/web/inc/lib/vendor/symfony/polyfill-php80/LICENSE index 5593b1d84..0ed3a2465 100644 --- a/data/web/inc/lib/vendor/symfony/polyfill-php80/LICENSE +++ b/data/web/inc/lib/vendor/symfony/polyfill-php80/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2020 Fabien Potencier +Copyright (c) 2020-present Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/data/web/inc/lib/vendor/symfony/polyfill-php80/Php80.php b/data/web/inc/lib/vendor/symfony/polyfill-php80/Php80.php index 5fef51184..362dd1a95 100644 --- a/data/web/inc/lib/vendor/symfony/polyfill-php80/Php80.php +++ b/data/web/inc/lib/vendor/symfony/polyfill-php80/Php80.php @@ -100,6 +100,16 @@ final class Php80 public static function str_ends_with(string $haystack, string $needle): bool { - return '' === $needle || ('' !== $haystack && 0 === substr_compare($haystack, $needle, -\strlen($needle))); + if ('' === $needle || $needle === $haystack) { + return true; + } + + if ('' === $haystack) { + return false; + } + + $needleLength = \strlen($needle); + + return $needleLength <= \strlen($haystack) && 0 === substr_compare($haystack, $needle, -$needleLength); } } diff --git a/data/web/inc/lib/vendor/symfony/polyfill-php80/PhpToken.php b/data/web/inc/lib/vendor/symfony/polyfill-php80/PhpToken.php new file mode 100644 index 000000000..fe6e69105 --- /dev/null +++ b/data/web/inc/lib/vendor/symfony/polyfill-php80/PhpToken.php @@ -0,0 +1,103 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Php80; + +/** + * @author Fedonyuk Anton + * + * @internal + */ +class PhpToken implements \Stringable +{ + /** + * @var int + */ + public $id; + + /** + * @var string + */ + public $text; + + /** + * @var int + */ + public $line; + + /** + * @var int + */ + public $pos; + + public function __construct(int $id, string $text, int $line = -1, int $position = -1) + { + $this->id = $id; + $this->text = $text; + $this->line = $line; + $this->pos = $position; + } + + public function getTokenName(): ?string + { + if ('UNKNOWN' === $name = token_name($this->id)) { + $name = \strlen($this->text) > 1 || \ord($this->text) < 32 ? null : $this->text; + } + + return $name; + } + + /** + * @param int|string|array $kind + */ + public function is($kind): bool + { + foreach ((array) $kind as $value) { + if (\in_array($value, [$this->id, $this->text], true)) { + return true; + } + } + + return false; + } + + public function isIgnorable(): bool + { + return \in_array($this->id, [\T_WHITESPACE, \T_COMMENT, \T_DOC_COMMENT, \T_OPEN_TAG], true); + } + + public function __toString(): string + { + return (string) $this->text; + } + + /** + * @return static[] + */ + public static function tokenize(string $code, int $flags = 0): array + { + $line = 1; + $position = 0; + $tokens = token_get_all($code, $flags); + foreach ($tokens as $index => $token) { + if (\is_string($token)) { + $id = \ord($token); + $text = $token; + } else { + [$id, $text, $line] = $token; + } + $tokens[$index] = new static($id, $text, $line, $position); + $position += \strlen($text); + } + + return $tokens; + } +} diff --git a/data/web/inc/lib/vendor/symfony/polyfill-php80/README.md b/data/web/inc/lib/vendor/symfony/polyfill-php80/README.md index 10b8ee49a..3816c559d 100644 --- a/data/web/inc/lib/vendor/symfony/polyfill-php80/README.md +++ b/data/web/inc/lib/vendor/symfony/polyfill-php80/README.md @@ -3,12 +3,13 @@ Symfony Polyfill / Php80 This component provides features added to PHP 8.0 core: -- `Stringable` interface +- [`Stringable`](https://php.net/stringable) interface - [`fdiv`](https://php.net/fdiv) -- `ValueError` class -- `UnhandledMatchError` class +- [`ValueError`](https://php.net/valueerror) class +- [`UnhandledMatchError`](https://php.net/unhandledmatcherror) class - `FILTER_VALIDATE_BOOL` constant - [`get_debug_type`](https://php.net/get_debug_type) +- [`PhpToken`](https://php.net/phptoken) class - [`preg_last_error_msg`](https://php.net/preg_last_error_msg) - [`str_contains`](https://php.net/str_contains) - [`str_starts_with`](https://php.net/str_starts_with) diff --git a/data/web/inc/lib/vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php b/data/web/inc/lib/vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php index 7ea6d2772..2b955423f 100644 --- a/data/web/inc/lib/vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php +++ b/data/web/inc/lib/vendor/symfony/polyfill-php80/Resources/stubs/Attribute.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + #[Attribute(Attribute::TARGET_CLASS)] final class Attribute { diff --git a/data/web/inc/lib/vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php b/data/web/inc/lib/vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php new file mode 100644 index 000000000..bd1212f6e --- /dev/null +++ b/data/web/inc/lib/vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +if (\PHP_VERSION_ID < 80000 && extension_loaded('tokenizer')) { + class PhpToken extends Symfony\Polyfill\Php80\PhpToken + { + } +} diff --git a/data/web/inc/lib/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php b/data/web/inc/lib/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php index 77e037cb5..7c62d7508 100644 --- a/data/web/inc/lib/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php +++ b/data/web/inc/lib/vendor/symfony/polyfill-php80/Resources/stubs/Stringable.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + if (\PHP_VERSION_ID < 80000) { interface Stringable { diff --git a/data/web/inc/lib/vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php b/data/web/inc/lib/vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php index 37937cbfa..01c6c6c8a 100644 --- a/data/web/inc/lib/vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php +++ b/data/web/inc/lib/vendor/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + if (\PHP_VERSION_ID < 80000) { class UnhandledMatchError extends Error { diff --git a/data/web/inc/lib/vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php b/data/web/inc/lib/vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php index a3a9b88b0..783dbc28c 100644 --- a/data/web/inc/lib/vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php +++ b/data/web/inc/lib/vendor/symfony/polyfill-php80/Resources/stubs/ValueError.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + if (\PHP_VERSION_ID < 80000) { class ValueError extends Error { diff --git a/data/web/inc/lib/vendor/symfony/polyfill-php80/composer.json b/data/web/inc/lib/vendor/symfony/polyfill-php80/composer.json index 5fe679db3..46ccde203 100644 --- a/data/web/inc/lib/vendor/symfony/polyfill-php80/composer.json +++ b/data/web/inc/lib/vendor/symfony/polyfill-php80/composer.json @@ -29,9 +29,6 @@ }, "minimum-stability": "dev", "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" diff --git a/data/web/inc/lib/vendor/symfony/translation-contracts/.gitignore b/data/web/inc/lib/vendor/symfony/translation-contracts/.gitignore deleted file mode 100644 index c49a5d8df..000000000 --- a/data/web/inc/lib/vendor/symfony/translation-contracts/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -vendor/ -composer.lock -phpunit.xml diff --git a/data/web/inc/lib/vendor/symfony/translation-contracts/LICENSE b/data/web/inc/lib/vendor/symfony/translation-contracts/LICENSE index 235841453..7536caeae 100644 --- a/data/web/inc/lib/vendor/symfony/translation-contracts/LICENSE +++ b/data/web/inc/lib/vendor/symfony/translation-contracts/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2018-2021 Fabien Potencier +Copyright (c) 2018-present Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/data/web/inc/lib/vendor/symfony/translation-contracts/LocaleAwareInterface.php b/data/web/inc/lib/vendor/symfony/translation-contracts/LocaleAwareInterface.php index 6923b977e..db40ba13e 100644 --- a/data/web/inc/lib/vendor/symfony/translation-contracts/LocaleAwareInterface.php +++ b/data/web/inc/lib/vendor/symfony/translation-contracts/LocaleAwareInterface.php @@ -16,6 +16,8 @@ interface LocaleAwareInterface /** * Sets the current locale. * + * @return void + * * @throws \InvalidArgumentException If the locale contains invalid characters */ public function setLocale(string $locale); diff --git a/data/web/inc/lib/vendor/symfony/translation-contracts/README.md b/data/web/inc/lib/vendor/symfony/translation-contracts/README.md index 42e5c5175..b211d5849 100644 --- a/data/web/inc/lib/vendor/symfony/translation-contracts/README.md +++ b/data/web/inc/lib/vendor/symfony/translation-contracts/README.md @@ -3,7 +3,7 @@ Symfony Translation Contracts A set of abstractions extracted out of the Symfony components. -Can be used to build on semantics that the Symfony components proved useful - and +Can be used to build on semantics that the Symfony components proved useful and that already have battle tested implementations. See https://github.com/symfony/contracts/blob/main/README.md for more information. diff --git a/data/web/inc/lib/vendor/symfony/translation-contracts/Test/TranslatorTest.php b/data/web/inc/lib/vendor/symfony/translation-contracts/Test/TranslatorTest.php index c2c30a917..756228af5 100644 --- a/data/web/inc/lib/vendor/symfony/translation-contracts/Test/TranslatorTest.php +++ b/data/web/inc/lib/vendor/symfony/translation-contracts/Test/TranslatorTest.php @@ -30,7 +30,7 @@ use Symfony\Contracts\Translation\TranslatorTrait; */ class TranslatorTest extends TestCase { - private $defaultLocale; + private string $defaultLocale; protected function setUp(): void { @@ -114,7 +114,7 @@ class TranslatorTest extends TestCase $this->assertEquals('en', $translator->getLocale()); } - public function getTransTests() + public static function getTransTests() { return [ ['Symfony is great!', 'Symfony is great!', []], @@ -122,7 +122,7 @@ class TranslatorTest extends TestCase ]; } - public function getTransChoiceTests() + public static function getTransChoiceTests() { return [ ['There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0], @@ -137,7 +137,7 @@ class TranslatorTest extends TestCase } /** - * @dataProvider getInternal + * @dataProvider getInterval */ public function testInterval($expected, $number, $interval) { @@ -146,7 +146,7 @@ class TranslatorTest extends TestCase $this->assertEquals($expected, $translator->trans($interval.' foo|[1,Inf[ bar', ['%count%' => $number])); } - public function getInternal() + public static function getInterval() { return [ ['foo', 3, '{1,2, 3 ,4}'], @@ -183,13 +183,14 @@ class TranslatorTest extends TestCase */ public function testThrowExceptionIfMatchingMessageCannotBeFound($id, $number) { - $this->expectException(\InvalidArgumentException::class); $translator = $this->getTranslator(); + $this->expectException(\InvalidArgumentException::class); + $translator->trans($id, ['%count%' => $number]); } - public function getNonMatchingMessages() + public static function getNonMatchingMessages() { return [ ['{0} There are no apples|{1} There is one apple', 2], @@ -199,7 +200,7 @@ class TranslatorTest extends TestCase ]; } - public function getChooseTests() + public static function getChooseTests() { return [ ['There are no apples', '{0} There are no apples|{1} There is one apple|]1,Inf] There are %count% apples', 0], @@ -255,13 +256,13 @@ class TranslatorTest extends TestCase new-line in it. Selector = 0.|{1}This is a text with a new-line in it. Selector = 1.|[1,Inf]This is a text with a new-line in it. Selector > 1.', 5], - // with double-quotes and id split accros lines + // with double-quotes and id split across lines ['This is a text with a new-line in it. Selector = 1.', '{0}This is a text with a new-line in it. Selector = 0.|{1}This is a text with a new-line in it. Selector = 1.|[1,Inf]This is a text with a new-line in it. Selector > 1.', 1], - // with single-quotes and id split accros lines + // with single-quotes and id split across lines ['This is a text with a new-line in it. Selector > 1.', '{0}This is a text with a new-line in it. Selector = 0.|{1}This is a text with a @@ -269,9 +270,9 @@ class TranslatorTest extends TestCase new-line in it. Selector > 1.', 5], // with single-quotes and \n in text ['This is a text with a\nnew-line in it. Selector = 0.', '{0}This is a text with a\nnew-line in it. Selector = 0.|{1}This is a text with a\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\nnew-line in it. Selector > 1.', 0], - // with double-quotes and id split accros lines + // with double-quotes and id split across lines ["This is a text with a\nnew-line in it. Selector = 1.", "{0}This is a text with a\nnew-line in it. Selector = 0.|{1}This is a text with a\nnew-line in it. Selector = 1.|[1,Inf]This is a text with a\nnew-line in it. Selector > 1.", 1], - // esacape pipe + // escape pipe ['This is a text with | in it. Selector = 0.', '{0}This is a text with || in it. Selector = 0.|{1}This is a text with || in it. Selector = 1.', 0], // Empty plural set (2 plural forms) from a .PO file ['', '|', 1], @@ -315,7 +316,7 @@ class TranslatorTest extends TestCase * * As it is impossible to have this ever complete we should try as hard as possible to have it almost complete. */ - public function successLangcodes(): array + public static function successLangcodes(): array { return [ ['1', ['ay', 'bo', 'cgg', 'dz', 'id', 'ja', 'jbo', 'ka', 'kk', 'km', 'ko', 'ky']], @@ -334,7 +335,7 @@ class TranslatorTest extends TestCase * * @return array with nplural together with langcodes */ - public function failingLangcodes(): array + public static function failingLangcodes(): array { return [ ['1', ['fa']], @@ -356,7 +357,7 @@ class TranslatorTest extends TestCase foreach ($matrix as $langCode => $data) { $indexes = array_flip($data); if ($expectSuccess) { - $this->assertEquals($nplural, \count($indexes), "Langcode '$langCode' has '$nplural' plural forms."); + $this->assertCount($nplural, $indexes, "Langcode '$langCode' has '$nplural' plural forms."); } else { $this->assertNotEquals((int) $nplural, \count($indexes), "Langcode '$langCode' has '$nplural' plural forms."); } diff --git a/data/web/inc/lib/vendor/symfony/translation-contracts/TranslatorTrait.php b/data/web/inc/lib/vendor/symfony/translation-contracts/TranslatorTrait.php index 9c264bd29..e3b0adff0 100644 --- a/data/web/inc/lib/vendor/symfony/translation-contracts/TranslatorTrait.php +++ b/data/web/inc/lib/vendor/symfony/translation-contracts/TranslatorTrait.php @@ -23,24 +23,18 @@ trait TranslatorTrait private ?string $locale = null; /** - * {@inheritdoc} + * @return void */ public function setLocale(string $locale) { $this->locale = $locale; } - /** - * {@inheritdoc} - */ public function getLocale(): string { return $this->locale ?: (class_exists(\Locale::class) ? \Locale::getDefault() : 'en'); } - /** - * {@inheritdoc} - */ public function trans(?string $id, array $parameters = [], string $domain = null, string $locale = null): string { if (null === $id || '' === $id) { @@ -140,121 +134,92 @@ EOF; { $number = abs($number); - switch ('pt_BR' !== $locale && 'en_US_POSIX' !== $locale && \strlen($locale) > 3 ? substr($locale, 0, strrpos($locale, '_')) : $locale) { - case 'af': - case 'bn': - case 'bg': - case 'ca': - case 'da': - case 'de': - case 'el': - case 'en': - case 'en_US_POSIX': - case 'eo': - case 'es': - case 'et': - case 'eu': - case 'fa': - case 'fi': - case 'fo': - case 'fur': - case 'fy': - case 'gl': - case 'gu': - case 'ha': - case 'he': - case 'hu': - case 'is': - case 'it': - case 'ku': - case 'lb': - case 'ml': - case 'mn': - case 'mr': - case 'nah': - case 'nb': - case 'ne': - case 'nl': - case 'nn': - case 'no': - case 'oc': - case 'om': - case 'or': - case 'pa': - case 'pap': - case 'ps': - case 'pt': - case 'so': - case 'sq': - case 'sv': - case 'sw': - case 'ta': - case 'te': - case 'tk': - case 'ur': - case 'zu': - return (1 == $number) ? 0 : 1; - - case 'am': - case 'bh': - case 'fil': - case 'fr': - case 'gun': - case 'hi': - case 'hy': - case 'ln': - case 'mg': - case 'nso': - case 'pt_BR': - case 'ti': - case 'wa': - return ($number < 2) ? 0 : 1; - - case 'be': - case 'bs': - case 'hr': - case 'ru': - case 'sh': - case 'sr': - case 'uk': - return ((1 == $number % 10) && (11 != $number % 100)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); - - case 'cs': - case 'sk': - return (1 == $number) ? 0 : ((($number >= 2) && ($number <= 4)) ? 1 : 2); - - case 'ga': - return (1 == $number) ? 0 : ((2 == $number) ? 1 : 2); - - case 'lt': - return ((1 == $number % 10) && (11 != $number % 100)) ? 0 : ((($number % 10 >= 2) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); - - case 'sl': - return (1 == $number % 100) ? 0 : ((2 == $number % 100) ? 1 : (((3 == $number % 100) || (4 == $number % 100)) ? 2 : 3)); - - case 'mk': - return (1 == $number % 10) ? 0 : 1; - - case 'mt': - return (1 == $number) ? 0 : (((0 == $number) || (($number % 100 > 1) && ($number % 100 < 11))) ? 1 : ((($number % 100 > 10) && ($number % 100 < 20)) ? 2 : 3)); - - case 'lv': - return (0 == $number) ? 0 : (((1 == $number % 10) && (11 != $number % 100)) ? 1 : 2); - - case 'pl': - return (1 == $number) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 12) || ($number % 100 > 14))) ? 1 : 2); - - case 'cy': - return (1 == $number) ? 0 : ((2 == $number) ? 1 : (((8 == $number) || (11 == $number)) ? 2 : 3)); - - case 'ro': - return (1 == $number) ? 0 : (((0 == $number) || (($number % 100 > 0) && ($number % 100 < 20))) ? 1 : 2); - - case 'ar': - return (0 == $number) ? 0 : ((1 == $number) ? 1 : ((2 == $number) ? 2 : ((($number % 100 >= 3) && ($number % 100 <= 10)) ? 3 : ((($number % 100 >= 11) && ($number % 100 <= 99)) ? 4 : 5)))); - - default: - return 0; - } + return match ('pt_BR' !== $locale && 'en_US_POSIX' !== $locale && \strlen($locale) > 3 ? substr($locale, 0, strrpos($locale, '_')) : $locale) { + 'af', + 'bn', + 'bg', + 'ca', + 'da', + 'de', + 'el', + 'en', + 'en_US_POSIX', + 'eo', + 'es', + 'et', + 'eu', + 'fa', + 'fi', + 'fo', + 'fur', + 'fy', + 'gl', + 'gu', + 'ha', + 'he', + 'hu', + 'is', + 'it', + 'ku', + 'lb', + 'ml', + 'mn', + 'mr', + 'nah', + 'nb', + 'ne', + 'nl', + 'nn', + 'no', + 'oc', + 'om', + 'or', + 'pa', + 'pap', + 'ps', + 'pt', + 'so', + 'sq', + 'sv', + 'sw', + 'ta', + 'te', + 'tk', + 'ur', + 'zu' => (1 == $number) ? 0 : 1, + 'am', + 'bh', + 'fil', + 'fr', + 'gun', + 'hi', + 'hy', + 'ln', + 'mg', + 'nso', + 'pt_BR', + 'ti', + 'wa' => ($number < 2) ? 0 : 1, + 'be', + 'bs', + 'hr', + 'ru', + 'sh', + 'sr', + 'uk' => ((1 == $number % 10) && (11 != $number % 100)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2), + 'cs', + 'sk' => (1 == $number) ? 0 : ((($number >= 2) && ($number <= 4)) ? 1 : 2), + 'ga' => (1 == $number) ? 0 : ((2 == $number) ? 1 : 2), + 'lt' => ((1 == $number % 10) && (11 != $number % 100)) ? 0 : ((($number % 10 >= 2) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2), + 'sl' => (1 == $number % 100) ? 0 : ((2 == $number % 100) ? 1 : (((3 == $number % 100) || (4 == $number % 100)) ? 2 : 3)), + 'mk' => (1 == $number % 10) ? 0 : 1, + 'mt' => (1 == $number) ? 0 : (((0 == $number) || (($number % 100 > 1) && ($number % 100 < 11))) ? 1 : ((($number % 100 > 10) && ($number % 100 < 20)) ? 2 : 3)), + 'lv' => (0 == $number) ? 0 : (((1 == $number % 10) && (11 != $number % 100)) ? 1 : 2), + 'pl' => (1 == $number) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 12) || ($number % 100 > 14))) ? 1 : 2), + 'cy' => (1 == $number) ? 0 : ((2 == $number) ? 1 : (((8 == $number) || (11 == $number)) ? 2 : 3)), + 'ro' => (1 == $number) ? 0 : (((0 == $number) || (($number % 100 > 0) && ($number % 100 < 20))) ? 1 : 2), + 'ar' => (0 == $number) ? 0 : ((1 == $number) ? 1 : ((2 == $number) ? 2 : ((($number % 100 >= 3) && ($number % 100 <= 10)) ? 3 : ((($number % 100 >= 11) && ($number % 100 <= 99)) ? 4 : 5)))), + default => 0, + }; } } diff --git a/data/web/inc/lib/vendor/symfony/translation-contracts/composer.json b/data/web/inc/lib/vendor/symfony/translation-contracts/composer.json index 875242f6d..213b5cda8 100644 --- a/data/web/inc/lib/vendor/symfony/translation-contracts/composer.json +++ b/data/web/inc/lib/vendor/symfony/translation-contracts/composer.json @@ -16,18 +16,18 @@ } ], "require": { - "php": ">=8.0.2" - }, - "suggest": { - "symfony/translation-implementation": "" + "php": ">=8.1" }, "autoload": { - "psr-4": { "Symfony\\Contracts\\Translation\\": "" } + "psr-4": { "Symfony\\Contracts\\Translation\\": "" }, + "exclude-from-classmap": [ + "/Test/" + ] }, "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", diff --git a/data/web/inc/lib/vendor/symfony/translation/CHANGELOG.md b/data/web/inc/lib/vendor/symfony/translation/CHANGELOG.md index 160b5e694..5f9098c07 100644 --- a/data/web/inc/lib/vendor/symfony/translation/CHANGELOG.md +++ b/data/web/inc/lib/vendor/symfony/translation/CHANGELOG.md @@ -1,6 +1,35 @@ CHANGELOG ========= +6.4 +--- + + * Give current locale to `LocaleSwitcher::runWithLocale()`'s callback + * Add `--as-tree` option to `translation:pull` command to write YAML messages as a tree-like structure + * [BC BREAK] Add argument `$buildDir` to `DataCollectorTranslator::warmUp()` + * Add `DataCollectorTranslatorPass` and `LoggingTranslatorPass` (moved from `FrameworkBundle`) + * Add `PhraseTranslationProvider` + +6.2.7 +----- + + * [BC BREAK] The following data providers for `ProviderFactoryTestCase` are now static: + `supportsProvider()`, `createProvider()`, `unsupportedSchemeProvider()`and `incompleteDsnProvider()` + * [BC BREAK] `ProviderTestCase::toStringProvider()` is now static + +6.2 +--- + + * Deprecate `PhpStringTokenParser` + * Deprecate `PhpExtractor` in favor of `PhpAstExtractor` + * Add `PhpAstExtractor` (requires [nikic/php-parser](https://github.com/nikic/php-parser) to be installed) + +6.1 +--- + + * Parameters implementing `TranslatableInterface` are processed + * Add the file extension to the `XliffFileDumper` constructor + 5.4 --- diff --git a/data/web/inc/lib/vendor/symfony/translation/Catalogue/AbstractOperation.php b/data/web/inc/lib/vendor/symfony/translation/Catalogue/AbstractOperation.php index 43a52fab2..7dff58ff4 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Catalogue/AbstractOperation.php +++ b/data/web/inc/lib/vendor/symfony/translation/Catalogue/AbstractOperation.php @@ -34,11 +34,6 @@ abstract class AbstractOperation implements OperationInterface protected $target; protected $result; - /** - * @var array|null The domains affected by this operation - */ - private $domains; - /** * This array stores 'all', 'new' and 'obsolete' messages for all valid domains. * @@ -62,6 +57,8 @@ abstract class AbstractOperation implements OperationInterface */ protected $messages; + private array $domains; + /** * @throws LogicException */ @@ -77,12 +74,9 @@ abstract class AbstractOperation implements OperationInterface $this->messages = []; } - /** - * {@inheritdoc} - */ public function getDomains(): array { - if (null === $this->domains) { + if (!isset($this->domains)) { $domains = []; foreach ([$this->source, $this->target] as $catalogue) { foreach ($catalogue->getDomains() as $domain) { @@ -100,9 +94,6 @@ abstract class AbstractOperation implements OperationInterface return $this->domains; } - /** - * {@inheritdoc} - */ public function getMessages(string $domain): array { if (!\in_array($domain, $this->getDomains())) { @@ -116,9 +107,6 @@ abstract class AbstractOperation implements OperationInterface return $this->messages[$domain][self::ALL_BATCH]; } - /** - * {@inheritdoc} - */ public function getNewMessages(string $domain): array { if (!\in_array($domain, $this->getDomains())) { @@ -132,9 +120,6 @@ abstract class AbstractOperation implements OperationInterface return $this->messages[$domain][self::NEW_BATCH]; } - /** - * {@inheritdoc} - */ public function getObsoleteMessages(string $domain): array { if (!\in_array($domain, $this->getDomains())) { @@ -148,9 +133,6 @@ abstract class AbstractOperation implements OperationInterface return $this->messages[$domain][self::OBSOLETE_BATCH]; } - /** - * {@inheritdoc} - */ public function getResult(): MessageCatalogueInterface { foreach ($this->getDomains() as $domain) { @@ -174,12 +156,12 @@ abstract class AbstractOperation implements OperationInterface foreach ($this->getDomains() as $domain) { $intlDomain = $domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX; - switch ($batch) { - case self::OBSOLETE_BATCH: $messages = $this->getObsoleteMessages($domain); break; - case self::NEW_BATCH: $messages = $this->getNewMessages($domain); break; - case self::ALL_BATCH: $messages = $this->getMessages($domain); break; - default: throw new \InvalidArgumentException(sprintf('$batch argument must be one of ["%s", "%s", "%s"].', self::ALL_BATCH, self::NEW_BATCH, self::OBSOLETE_BATCH)); - } + $messages = match ($batch) { + self::OBSOLETE_BATCH => $this->getObsoleteMessages($domain), + self::NEW_BATCH => $this->getNewMessages($domain), + self::ALL_BATCH => $this->getMessages($domain), + default => throw new \InvalidArgumentException(sprintf('$batch argument must be one of ["%s", "%s", "%s"].', self::ALL_BATCH, self::NEW_BATCH, self::OBSOLETE_BATCH)), + }; if (!$messages || (!$this->source->all($intlDomain) && $this->source->all($domain))) { continue; @@ -198,6 +180,8 @@ abstract class AbstractOperation implements OperationInterface * stores the results. * * @param string $domain The domain which the operation will be performed for + * + * @return void */ abstract protected function processDomain(string $domain); } diff --git a/data/web/inc/lib/vendor/symfony/translation/Catalogue/MergeOperation.php b/data/web/inc/lib/vendor/symfony/translation/Catalogue/MergeOperation.php index 87db2fb03..1b777a843 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Catalogue/MergeOperation.php +++ b/data/web/inc/lib/vendor/symfony/translation/Catalogue/MergeOperation.php @@ -25,7 +25,7 @@ use Symfony\Component\Translation\MessageCatalogueInterface; class MergeOperation extends AbstractOperation { /** - * {@inheritdoc} + * @return void */ protected function processDomain(string $domain) { @@ -36,6 +36,18 @@ class MergeOperation extends AbstractOperation ]; $intlDomain = $domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX; + foreach ($this->target->getCatalogueMetadata('', $domain) ?? [] as $key => $value) { + if (null === $this->result->getCatalogueMetadata($key, $domain)) { + $this->result->setCatalogueMetadata($key, $value, $domain); + } + } + + foreach ($this->target->getCatalogueMetadata('', $intlDomain) ?? [] as $key => $value) { + if (null === $this->result->getCatalogueMetadata($key, $intlDomain)) { + $this->result->setCatalogueMetadata($key, $value, $intlDomain); + } + } + foreach ($this->source->all($domain) as $id => $message) { $this->messages[$domain]['all'][$id] = $message; $d = $this->source->defines($id, $intlDomain) ? $intlDomain : $domain; diff --git a/data/web/inc/lib/vendor/symfony/translation/Catalogue/TargetOperation.php b/data/web/inc/lib/vendor/symfony/translation/Catalogue/TargetOperation.php index 682b5752f..2c0ec722e 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Catalogue/TargetOperation.php +++ b/data/web/inc/lib/vendor/symfony/translation/Catalogue/TargetOperation.php @@ -26,7 +26,7 @@ use Symfony\Component\Translation\MessageCatalogueInterface; class TargetOperation extends AbstractOperation { /** - * {@inheritdoc} + * @return void */ protected function processDomain(string $domain) { @@ -37,6 +37,18 @@ class TargetOperation extends AbstractOperation ]; $intlDomain = $domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX; + foreach ($this->target->getCatalogueMetadata('', $domain) ?? [] as $key => $value) { + if (null === $this->result->getCatalogueMetadata($key, $domain)) { + $this->result->setCatalogueMetadata($key, $value, $domain); + } + } + + foreach ($this->target->getCatalogueMetadata('', $intlDomain) ?? [] as $key => $value) { + if (null === $this->result->getCatalogueMetadata($key, $intlDomain)) { + $this->result->setCatalogueMetadata($key, $value, $intlDomain); + } + } + // For 'all' messages, the code can't be simplified as ``$this->messages[$domain]['all'] = $target->all($domain);``, // because doing so will drop messages like {x: x ∈ source ∧ x ∉ target.all ∧ x ∈ target.fallback} // diff --git a/data/web/inc/lib/vendor/symfony/translation/CatalogueMetadataAwareInterface.php b/data/web/inc/lib/vendor/symfony/translation/CatalogueMetadataAwareInterface.php new file mode 100644 index 000000000..c845959f1 --- /dev/null +++ b/data/web/inc/lib/vendor/symfony/translation/CatalogueMetadataAwareInterface.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Translation; + +/** + * This interface is used to get, set, and delete metadata about the Catalogue. + * + * @author Hugo Alliaume + */ +interface CatalogueMetadataAwareInterface +{ + /** + * Gets catalogue metadata for the given domain and key. + * + * Passing an empty domain will return an array with all catalogue metadata indexed by + * domain and then by key. Passing an empty key will return an array with all + * catalogue metadata for the given domain. + * + * @return mixed The value that was set or an array with the domains/keys or null + */ + public function getCatalogueMetadata(string $key = '', string $domain = 'messages'): mixed; + + /** + * Adds catalogue metadata to a message domain. + * + * @return void + */ + public function setCatalogueMetadata(string $key, mixed $value, string $domain = 'messages'); + + /** + * Deletes catalogue metadata for the given key and domain. + * + * Passing an empty domain will delete all catalogue metadata. Passing an empty key will + * delete all metadata for the given domain. + * + * @return void + */ + public function deleteCatalogueMetadata(string $key = '', string $domain = 'messages'); +} diff --git a/data/web/inc/lib/vendor/symfony/translation/Command/TranslationPullCommand.php b/data/web/inc/lib/vendor/symfony/translation/Command/TranslationPullCommand.php index 42513a8a8..5d9c092c3 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Command/TranslationPullCommand.php +++ b/data/web/inc/lib/vendor/symfony/translation/Command/TranslationPullCommand.php @@ -34,9 +34,9 @@ final class TranslationPullCommand extends Command { use TranslationTrait; - private $providerCollection; - private $writer; - private $reader; + private TranslationProviderCollection $providerCollection; + private TranslationWriterInterface $writer; + private TranslationReaderInterface $reader; private string $defaultLocale; private array $transPaths; private array $enabledLocales; @@ -64,9 +64,8 @@ final class TranslationPullCommand extends Command if ($input->mustSuggestOptionValuesFor('domains')) { $provider = $this->providerCollection->get($input->getArgument('provider')); - if ($provider && method_exists($provider, 'getDomains')) { - $domains = $provider->getDomains(); - $suggestions->suggestValues($domains); + if (method_exists($provider, 'getDomains')) { + $suggestions->suggestValues($provider->getDomains()); } return; @@ -83,10 +82,7 @@ final class TranslationPullCommand extends Command } } - /** - * {@inheritdoc} - */ - protected function configure() + protected function configure(): void { $keys = $this->providerCollection->keys(); $defaultProvider = 1 === \count($keys) ? $keys[0] : null; @@ -99,6 +95,7 @@ final class TranslationPullCommand extends Command new InputOption('domains', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'Specify the domains to pull.'), new InputOption('locales', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'Specify the locales to pull.'), new InputOption('format', null, InputOption::VALUE_OPTIONAL, 'Override the default output format.', 'xlf12'), + new InputOption('as-tree', null, InputOption::VALUE_OPTIONAL, 'Write messages as a tree-like structure. Needs --format=yaml. The given value defines the level where to switch to inline YAML'), ]) ->setHelp(<<<'EOF' The %command.name% command pulls translations from the given provider. Only @@ -120,9 +117,6 @@ EOF ; } - /** - * {@inheritdoc} - */ protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); @@ -133,6 +127,7 @@ EOF $locales = $input->getOption('locales') ?: $this->enabledLocales; $domains = $input->getOption('domains'); $format = $input->getOption('format'); + $asTree = (int) $input->getOption('as-tree'); $xliffVersion = '1.2'; if ($intlIcu && !$force) { @@ -141,7 +136,7 @@ EOF switch ($format) { case 'xlf20': $xliffVersion = '2.0'; - // no break + // no break case 'xlf12': $format = 'xlf'; } @@ -149,6 +144,8 @@ EOF 'path' => end($this->transPaths), 'xliff_version' => $xliffVersion, 'default_locale' => $this->defaultLocale, + 'as_tree' => (bool) $asTree, + 'inline' => $asTree, ]; if (!$domains) { @@ -159,7 +156,7 @@ EOF if ($force) { foreach ($providerTranslations->getCatalogues() as $catalogue) { - $operation = new TargetOperation((new MessageCatalogue($catalogue->getLocale())), $catalogue); + $operation = new TargetOperation(new MessageCatalogue($catalogue->getLocale()), $catalogue); if ($intlIcu) { $operation->moveMessagesToIntlDomainsIfPossible(); } diff --git a/data/web/inc/lib/vendor/symfony/translation/Command/TranslationPushCommand.php b/data/web/inc/lib/vendor/symfony/translation/Command/TranslationPushCommand.php index dba21643d..1d04adbc9 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Command/TranslationPushCommand.php +++ b/data/web/inc/lib/vendor/symfony/translation/Command/TranslationPushCommand.php @@ -21,6 +21,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\Translation\Provider\FilteringProvider; use Symfony\Component\Translation\Provider\TranslationProviderCollection; use Symfony\Component\Translation\Reader\TranslationReaderInterface; use Symfony\Component\Translation\TranslatorBag; @@ -33,8 +34,8 @@ final class TranslationPushCommand extends Command { use TranslationTrait; - private $providers; - private $reader; + private TranslationProviderCollection $providers; + private TranslationReaderInterface $reader; private array $transPaths; private array $enabledLocales; @@ -72,10 +73,7 @@ final class TranslationPushCommand extends Command } } - /** - * {@inheritdoc} - */ - protected function configure() + protected function configure(): void { $keys = $this->providers->keys(); $defaultProvider = 1 === \count($keys) ? $keys[0] : null; @@ -112,15 +110,12 @@ EOF ; } - /** - * {@inheritdoc} - */ protected function execute(InputInterface $input, OutputInterface $output): int { $provider = $this->providers->get($input->getArgument('provider')); if (!$this->enabledLocales) { - throw new InvalidArgumentException(sprintf('You must define "framework.translator.enabled_locales" or "framework.translator.providers.%s.locales" config key in order to work with translation providers.', parse_url($provider, \PHP_URL_SCHEME))); + throw new InvalidArgumentException(sprintf('You must define "framework.enabled_locales" or "framework.translator.providers.%s.locales" config key in order to work with translation providers.', parse_url($provider, \PHP_URL_SCHEME))); } $io = new SymfonyStyle($input, $output); @@ -129,6 +124,12 @@ EOF $force = $input->getOption('force'); $deleteMissing = $input->getOption('delete-missing'); + if (!$domains && $provider instanceof FilteringProvider) { + $domains = $provider->getDomains(); + } + + // Reading local translations must be done after retrieving the domains from the provider + // in order to manage only translations from configured domains $localTranslations = $this->readLocalTranslations($locales, $domains, $this->transPaths); if (!$domains) { diff --git a/data/web/inc/lib/vendor/symfony/translation/Command/XliffLintCommand.php b/data/web/inc/lib/vendor/symfony/translation/Command/XliffLintCommand.php index f062fb79f..ba946389e 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Command/XliffLintCommand.php +++ b/data/web/inc/lib/vendor/symfony/translation/Command/XliffLintCommand.php @@ -41,23 +41,23 @@ class XliffLintCommand extends Command private ?\Closure $isReadableProvider; private bool $requireStrictFileNames; - public function __construct(string $name = null, callable $directoryIteratorProvider = null, callable $isReadableProvider = null, bool $requireStrictFileNames = true) + public function __construct(?string $name = null, ?callable $directoryIteratorProvider = null, ?callable $isReadableProvider = null, bool $requireStrictFileNames = true) { parent::__construct($name); - $this->directoryIteratorProvider = null === $directoryIteratorProvider || $directoryIteratorProvider instanceof \Closure ? $directoryIteratorProvider : \Closure::fromCallable($directoryIteratorProvider); - $this->isReadableProvider = null === $isReadableProvider || $isReadableProvider instanceof \Closure ? $isReadableProvider : \Closure::fromCallable($isReadableProvider); + $this->directoryIteratorProvider = null === $directoryIteratorProvider ? null : $directoryIteratorProvider(...); + $this->isReadableProvider = null === $isReadableProvider ? null : $isReadableProvider(...); $this->requireStrictFileNames = $requireStrictFileNames; } /** - * {@inheritdoc} + * @return void */ protected function configure() { $this ->addArgument('filename', InputArgument::IS_ARRAY, 'A file, a directory or "-" for reading from STDIN') - ->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format') + ->addOption('format', null, InputOption::VALUE_REQUIRED, sprintf('The output format ("%s")', implode('", "', $this->getAvailableFormatOptions()))) ->setHelp(<<%command.name% command lints an XLIFF file and outputs to STDOUT the first encountered syntax error. @@ -109,7 +109,7 @@ EOF return $this->display($io, $filesInfo); } - private function validate(string $content, string $file = null): array + private function validate(string $content, ?string $file = null): array { $errors = []; @@ -154,21 +154,17 @@ EOF return ['file' => $file, 'valid' => 0 === \count($errors), 'messages' => $errors]; } - private function display(SymfonyStyle $io, array $files) + private function display(SymfonyStyle $io, array $files): int { - switch ($this->format) { - case 'txt': - return $this->displayTxt($io, $files); - case 'json': - return $this->displayJson($io, $files); - case 'github': - return $this->displayTxt($io, $files, true); - default: - throw new InvalidArgumentException(sprintf('The format "%s" is not supported.', $this->format)); - } + return match ($this->format) { + 'txt' => $this->displayTxt($io, $files), + 'json' => $this->displayJson($io, $files), + 'github' => $this->displayTxt($io, $files, true), + default => throw new InvalidArgumentException(sprintf('Supported formats are "%s".', implode('", "', $this->getAvailableFormatOptions()))), + }; } - private function displayTxt(SymfonyStyle $io, array $filesInfo, bool $errorAsGithubAnnotations = false) + private function displayTxt(SymfonyStyle $io, array $filesInfo, bool $errorAsGithubAnnotations = false): int { $countFiles = \count($filesInfo); $erroredFiles = 0; @@ -184,9 +180,7 @@ EOF // general document errors have a '-1' line number $line = -1 === $error['line'] ? null : $error['line']; - if ($githubReporter) { - $githubReporter->error($error['message'], $info['file'], $line, null !== $line ? $error['column'] : null); - } + $githubReporter?->error($error['message'], $info['file'], $line, null !== $line ? $error['column'] : null); return null === $line ? $error['message'] : sprintf('Line %d, Column %d: %s', $line, $error['column'], $error['message']); }, $info['messages'])); @@ -202,7 +196,7 @@ EOF return min($erroredFiles, 1); } - private function displayJson(SymfonyStyle $io, array $filesInfo) + private function displayJson(SymfonyStyle $io, array $filesInfo): int { $errors = 0; @@ -218,7 +212,10 @@ EOF return min($errors, 1); } - private function getFiles(string $fileOrDirectory) + /** + * @return iterable<\SplFileInfo> + */ + private function getFiles(string $fileOrDirectory): iterable { if (is_file($fileOrDirectory)) { yield new \SplFileInfo($fileOrDirectory); @@ -235,14 +232,15 @@ EOF } } - private function getDirectoryIterator(string $directory) + /** + * @return iterable<\SplFileInfo> + */ + private function getDirectoryIterator(string $directory): iterable { - $default = function ($directory) { - return new \RecursiveIteratorIterator( - new \RecursiveDirectoryIterator($directory, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), - \RecursiveIteratorIterator::LEAVES_ONLY - ); - }; + $default = fn ($directory) => new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($directory, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), + \RecursiveIteratorIterator::LEAVES_ONLY + ); if (null !== $this->directoryIteratorProvider) { return ($this->directoryIteratorProvider)($directory, $default); @@ -251,11 +249,9 @@ EOF return $default($directory); } - private function isReadable(string $fileOrDirectory) + private function isReadable(string $fileOrDirectory): bool { - $default = function ($fileOrDirectory) { - return is_readable($fileOrDirectory); - }; + $default = fn ($fileOrDirectory) => is_readable($fileOrDirectory); if (null !== $this->isReadableProvider) { return ($this->isReadableProvider)($fileOrDirectory, $default); @@ -278,7 +274,12 @@ EOF public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void { if ($input->mustSuggestOptionValuesFor('format')) { - $suggestions->suggestValues(['txt', 'json', 'github']); + $suggestions->suggestValues($this->getAvailableFormatOptions()); } } + + private function getAvailableFormatOptions(): array + { + return ['txt', 'json', 'github']; + } } diff --git a/data/web/inc/lib/vendor/symfony/translation/DataCollector/TranslationDataCollector.php b/data/web/inc/lib/vendor/symfony/translation/DataCollector/TranslationDataCollector.php index 0f7901d52..d4f49cc66 100644 --- a/data/web/inc/lib/vendor/symfony/translation/DataCollector/TranslationDataCollector.php +++ b/data/web/inc/lib/vendor/symfony/translation/DataCollector/TranslationDataCollector.php @@ -25,17 +25,14 @@ use Symfony\Component\VarDumper\Cloner\Data; */ class TranslationDataCollector extends DataCollector implements LateDataCollectorInterface { - private $translator; + private DataCollectorTranslator $translator; public function __construct(DataCollectorTranslator $translator) { $this->translator = $translator; } - /** - * {@inheritdoc} - */ - public function lateCollect() + public function lateCollect(): void { $messages = $this->sanitizeCollectedMessages($this->translator->getCollectedMessages()); @@ -45,19 +42,13 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto $this->data = $this->cloneVar($this->data); } - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Throwable $exception = null) + public function collect(Request $request, Response $response, ?\Throwable $exception = null): void { $this->data['locale'] = $this->translator->getLocale(); $this->data['fallback_locales'] = $this->translator->getFallbackLocales(); } - /** - * {@inheritdoc} - */ - public function reset() + public function reset(): void { $this->data = []; } @@ -82,7 +73,7 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto return $this->data[DataCollectorTranslator::MESSAGE_DEFINED] ?? 0; } - public function getLocale() + public function getLocale(): ?string { return !empty($this->data['locale']) ? $this->data['locale'] : null; } @@ -90,20 +81,17 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto /** * @internal */ - public function getFallbackLocales() + public function getFallbackLocales(): Data|array { return (isset($this->data['fallback_locales']) && \count($this->data['fallback_locales']) > 0) ? $this->data['fallback_locales'] : []; } - /** - * {@inheritdoc} - */ public function getName(): string { return 'translation'; } - private function sanitizeCollectedMessages(array $messages) + private function sanitizeCollectedMessages(array $messages): array { $result = []; foreach ($messages as $key => $message) { @@ -128,7 +116,7 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto return $result; } - private function computeCount(array $messages) + private function computeCount(array $messages): array { $count = [ DataCollectorTranslator::MESSAGE_DEFINED => 0, @@ -143,7 +131,7 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto return $count; } - private function sanitizeString(string $string, int $length = 80) + private function sanitizeString(string $string, int $length = 80): string { $string = trim(preg_replace('/\s+/', ' ', $string)); diff --git a/data/web/inc/lib/vendor/symfony/translation/DataCollectorTranslator.php b/data/web/inc/lib/vendor/symfony/translation/DataCollectorTranslator.php index 2a08b0960..a2832ee8e 100644 --- a/data/web/inc/lib/vendor/symfony/translation/DataCollectorTranslator.php +++ b/data/web/inc/lib/vendor/symfony/translation/DataCollectorTranslator.php @@ -25,7 +25,7 @@ class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInter public const MESSAGE_MISSING = 1; public const MESSAGE_EQUALS_FALLBACK = 2; - private $translator; + private TranslatorInterface $translator; private array $messages = []; /** @@ -40,10 +40,7 @@ class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInter $this->translator = $translator; } - /** - * {@inheritdoc} - */ - public function trans(?string $id, array $parameters = [], string $domain = null, string $locale = null): string + public function trans(?string $id, array $parameters = [], ?string $domain = null, ?string $locale = null): string { $trans = $this->translator->trans($id = (string) $id, $parameters, $domain, $locale); $this->collectMessage($locale, $domain, $id, $trans, $parameters); @@ -52,46 +49,32 @@ class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInter } /** - * {@inheritdoc} + * @return void */ public function setLocale(string $locale) { $this->translator->setLocale($locale); } - /** - * {@inheritdoc} - */ public function getLocale(): string { return $this->translator->getLocale(); } - /** - * {@inheritdoc} - */ - public function getCatalogue(string $locale = null): MessageCatalogueInterface + public function getCatalogue(?string $locale = null): MessageCatalogueInterface { return $this->translator->getCatalogue($locale); } - /** - * {@inheritdoc} - */ public function getCatalogues(): array { return $this->translator->getCatalogues(); } - /** - * {@inheritdoc} - * - * @return string[] - */ - public function warmUp(string $cacheDir): array + public function warmUp(string $cacheDir, ?string $buildDir = null): array { if ($this->translator instanceof WarmableInterface) { - return (array) $this->translator->warmUp($cacheDir); + return (array) $this->translator->warmUp($cacheDir, $buildDir); } return []; @@ -110,7 +93,7 @@ class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInter } /** - * Passes through all unknown calls onto the translator object. + * @return mixed */ public function __call(string $method, array $args) { @@ -122,11 +105,9 @@ class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInter return $this->messages; } - private function collectMessage(?string $locale, ?string $domain, string $id, string $translation, ?array $parameters = []) + private function collectMessage(?string $locale, ?string $domain, string $id, string $translation, ?array $parameters = []): void { - if (null === $domain) { - $domain = 'messages'; - } + $domain ??= 'messages'; $catalogue = $this->translator->getCatalogue($locale); $locale = $catalogue->getLocale(); diff --git a/data/web/inc/lib/vendor/symfony/translation/DependencyInjection/DataCollectorTranslatorPass.php b/data/web/inc/lib/vendor/symfony/translation/DependencyInjection/DataCollectorTranslatorPass.php new file mode 100644 index 000000000..cdf63be4b --- /dev/null +++ b/data/web/inc/lib/vendor/symfony/translation/DependencyInjection/DataCollectorTranslatorPass.php @@ -0,0 +1,36 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Translation\DependencyInjection; + +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\Translation\TranslatorBagInterface; + +/** + * @author Christian Flothmann + */ +class DataCollectorTranslatorPass implements CompilerPassInterface +{ + public function process(ContainerBuilder $container): void + { + if (!$container->has('translator')) { + return; + } + + $translatorClass = $container->getParameterBag()->resolveValue($container->findDefinition('translator')->getClass()); + + if (!is_subclass_of($translatorClass, TranslatorBagInterface::class)) { + $container->removeDefinition('translator.data_collector'); + $container->removeDefinition('data_collector.translation'); + } + } +} diff --git a/data/web/inc/lib/vendor/symfony/translation/DependencyInjection/LoggingTranslatorPass.php b/data/web/inc/lib/vendor/symfony/translation/DependencyInjection/LoggingTranslatorPass.php new file mode 100644 index 000000000..c21552f97 --- /dev/null +++ b/data/web/inc/lib/vendor/symfony/translation/DependencyInjection/LoggingTranslatorPass.php @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Translation\DependencyInjection; + +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use Symfony\Component\Translation\TranslatorBagInterface; +use Symfony\Contracts\Translation\TranslatorInterface; + +/** + * @author Abdellatif Ait boudad + */ +class LoggingTranslatorPass implements CompilerPassInterface +{ + public function process(ContainerBuilder $container): void + { + if (!$container->hasAlias('logger') || !$container->hasAlias('translator')) { + return; + } + + if (!$container->hasParameter('translator.logging') || !$container->getParameter('translator.logging')) { + return; + } + + $translatorAlias = $container->getAlias('translator'); + $definition = $container->getDefinition((string) $translatorAlias); + $class = $container->getParameterBag()->resolveValue($definition->getClass()); + + if (!$r = $container->getReflectionClass($class)) { + throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $translatorAlias)); + } + + if (!$r->isSubclassOf(TranslatorInterface::class) || !$r->isSubclassOf(TranslatorBagInterface::class)) { + return; + } + + $container->getDefinition('translator.logging')->setDecoratedService('translator'); + $warmer = $container->getDefinition('translation.warmer'); + $subscriberAttributes = $warmer->getTag('container.service_subscriber'); + $warmer->clearTag('container.service_subscriber'); + + foreach ($subscriberAttributes as $k => $v) { + if ((!isset($v['id']) || 'translator' !== $v['id']) && (!isset($v['key']) || 'translator' !== $v['key'])) { + $warmer->addTag('container.service_subscriber', $v); + } + } + $warmer->addTag('container.service_subscriber', ['key' => 'translator', 'id' => 'translator.logging.inner']); + } +} diff --git a/data/web/inc/lib/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php b/data/web/inc/lib/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php index 4020a0788..2ece6ac7b 100644 --- a/data/web/inc/lib/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php +++ b/data/web/inc/lib/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php @@ -20,6 +20,9 @@ use Symfony\Component\DependencyInjection\Reference; */ class TranslationDumperPass implements CompilerPassInterface { + /** + * @return void + */ public function process(ContainerBuilder $container) { if (!$container->hasDefinition('translation.writer')) { diff --git a/data/web/inc/lib/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php b/data/web/inc/lib/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php index ee7c47ae4..1baf9341e 100644 --- a/data/web/inc/lib/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php +++ b/data/web/inc/lib/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php @@ -21,6 +21,9 @@ use Symfony\Component\DependencyInjection\Reference; */ class TranslationExtractorPass implements CompilerPassInterface { + /** + * @return void + */ public function process(ContainerBuilder $container) { if (!$container->hasDefinition('translation.extractor')) { diff --git a/data/web/inc/lib/vendor/symfony/translation/DependencyInjection/TranslatorPass.php b/data/web/inc/lib/vendor/symfony/translation/DependencyInjection/TranslatorPass.php index be79cdaf0..dd6ea3c83 100644 --- a/data/web/inc/lib/vendor/symfony/translation/DependencyInjection/TranslatorPass.php +++ b/data/web/inc/lib/vendor/symfony/translation/DependencyInjection/TranslatorPass.php @@ -18,6 +18,9 @@ use Symfony\Component\DependencyInjection\Reference; class TranslatorPass implements CompilerPassInterface { + /** + * @return void + */ public function process(ContainerBuilder $container) { if (!$container->hasDefinition('translator.default')) { @@ -49,6 +52,23 @@ class TranslatorPass implements CompilerPassInterface ->replaceArgument(3, $loaders) ; + if ($container->hasDefinition('validator') && $container->hasDefinition('translation.extractor.visitor.constraint')) { + $constraintVisitorDefinition = $container->getDefinition('translation.extractor.visitor.constraint'); + $constraintClassNames = []; + + foreach ($container->getDefinitions() as $definition) { + if (!$definition->hasTag('validator.constraint_validator')) { + continue; + } + // Resolve constraint validator FQCN even if defined as %foo.validator.class% parameter + $className = $container->getParameterBag()->resolveValue($definition->getClass()); + // Extraction of the constraint class name from the Constraint Validator FQCN + $constraintClassNames[] = str_replace('Validator', '', substr(strrchr($className, '\\'), 1)); + } + + $constraintVisitorDefinition->setArgument(0, $constraintClassNames); + } + if (!$container->hasParameter('twig.default_path')) { return; } diff --git a/data/web/inc/lib/vendor/symfony/translation/DependencyInjection/TranslatorPathsPass.php b/data/web/inc/lib/vendor/symfony/translation/DependencyInjection/TranslatorPathsPass.php index b85c06621..1756e3c8c 100644 --- a/data/web/inc/lib/vendor/symfony/translation/DependencyInjection/TranslatorPathsPass.php +++ b/data/web/inc/lib/vendor/symfony/translation/DependencyInjection/TranslatorPathsPass.php @@ -16,12 +16,15 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\ServiceLocator; +use Symfony\Component\HttpKernel\Controller\ArgumentResolver\TraceableValueResolver; /** * @author Yonel Ceruto */ class TranslatorPathsPass extends AbstractRecursivePass { + protected bool $skipScalars = true; + private int $level = 0; /** @@ -39,6 +42,9 @@ class TranslatorPathsPass extends AbstractRecursivePass */ private array $controllers = []; + /** + * @return void + */ public function process(ContainerBuilder $container) { if (!$container->hasDefinition('translator')) { @@ -120,28 +126,20 @@ class TranslatorPathsPass extends AbstractRecursivePass private function findControllerArguments(ContainerBuilder $container): array { - if ($container->hasDefinition('argument_resolver.service')) { - $argument = $container->getDefinition('argument_resolver.service')->getArgument(0); - if ($argument instanceof Reference) { - $argument = $container->getDefinition($argument); - } + if (!$container->has('argument_resolver.service')) { + return []; + } + $resolverDef = $container->findDefinition('argument_resolver.service'); - return $argument->getArgument(0); + if (TraceableValueResolver::class === $resolverDef->getClass()) { + $resolverDef = $container->getDefinition($resolverDef->getArgument(0)); } - if ($container->hasDefinition('debug.'.'argument_resolver.service')) { - $argument = $container->getDefinition('debug.'.'argument_resolver.service')->getArgument(0); - if ($argument instanceof Reference) { - $argument = $container->getDefinition($argument); - } - $argument = $argument->getArgument(0); - if ($argument instanceof Reference) { - $argument = $container->getDefinition($argument); - } - - return $argument->getArgument(0); + $argument = $resolverDef->getArgument(0); + if ($argument instanceof Reference) { + $argument = $container->getDefinition($argument); } - return []; + return $argument->getArgument(0); } } diff --git a/data/web/inc/lib/vendor/symfony/translation/Dumper/CsvFileDumper.php b/data/web/inc/lib/vendor/symfony/translation/Dumper/CsvFileDumper.php index 0bd3f5e0f..8f5475259 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Dumper/CsvFileDumper.php +++ b/data/web/inc/lib/vendor/symfony/translation/Dumper/CsvFileDumper.php @@ -23,9 +23,6 @@ class CsvFileDumper extends FileDumper private string $delimiter = ';'; private string $enclosure = '"'; - /** - * {@inheritdoc} - */ public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string { $handle = fopen('php://memory', 'r+'); @@ -43,6 +40,8 @@ class CsvFileDumper extends FileDumper /** * Sets the delimiter and escape character for CSV. + * + * @return void */ public function setCsvControl(string $delimiter = ';', string $enclosure = '"') { @@ -50,9 +49,6 @@ class CsvFileDumper extends FileDumper $this->enclosure = $enclosure; } - /** - * {@inheritdoc} - */ protected function getExtension(): string { return 'csv'; diff --git a/data/web/inc/lib/vendor/symfony/translation/Dumper/DumperInterface.php b/data/web/inc/lib/vendor/symfony/translation/Dumper/DumperInterface.php index 7cdaef515..6bf42931e 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Dumper/DumperInterface.php +++ b/data/web/inc/lib/vendor/symfony/translation/Dumper/DumperInterface.php @@ -25,6 +25,8 @@ interface DumperInterface * Dumps the message catalogue. * * @param array $options Options that are used by the dumper + * + * @return void */ public function dump(MessageCatalogue $messages, array $options = []); } diff --git a/data/web/inc/lib/vendor/symfony/translation/Dumper/FileDumper.php b/data/web/inc/lib/vendor/symfony/translation/Dumper/FileDumper.php index 6bad4ff32..e30d4770e 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Dumper/FileDumper.php +++ b/data/web/inc/lib/vendor/symfony/translation/Dumper/FileDumper.php @@ -35,7 +35,7 @@ abstract class FileDumper implements DumperInterface /** * Sets the template for the relative paths to files. * - * @param string $relativePathTemplate A template for the relative paths to files + * @return void */ public function setRelativePathTemplate(string $relativePathTemplate) { @@ -43,7 +43,7 @@ abstract class FileDumper implements DumperInterface } /** - * {@inheritdoc} + * @return void */ public function dump(MessageCatalogue $messages, array $options = []) { diff --git a/data/web/inc/lib/vendor/symfony/translation/Dumper/IcuResFileDumper.php b/data/web/inc/lib/vendor/symfony/translation/Dumper/IcuResFileDumper.php index b62ea1536..72c1ec089 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Dumper/IcuResFileDumper.php +++ b/data/web/inc/lib/vendor/symfony/translation/Dumper/IcuResFileDumper.php @@ -20,14 +20,8 @@ use Symfony\Component\Translation\MessageCatalogue; */ class IcuResFileDumper extends FileDumper { - /** - * {@inheritdoc} - */ protected $relativePathTemplate = '%domain%/%locale%.%extension%'; - /** - * {@inheritdoc} - */ public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string { $data = $indexes = $resources = ''; @@ -47,7 +41,7 @@ class IcuResFileDumper extends FileDumper $data .= pack('V', \strlen($target)) .mb_convert_encoding($target."\0", 'UTF-16LE', 'UTF-8') .$this->writePadding($data) - ; + ; } $resOffset = $this->getPosition($data); @@ -56,7 +50,7 @@ class IcuResFileDumper extends FileDumper .$indexes .$this->writePadding($data) .$resources - ; + ; $bundleTop = $this->getPosition($data); @@ -89,14 +83,11 @@ class IcuResFileDumper extends FileDumper return $padding ? str_repeat("\xAA", 4 - $padding) : null; } - private function getPosition(string $data) + private function getPosition(string $data): float|int { return (\strlen($data) + 28) / 4; } - /** - * {@inheritdoc} - */ protected function getExtension(): string { return 'res'; diff --git a/data/web/inc/lib/vendor/symfony/translation/Dumper/IniFileDumper.php b/data/web/inc/lib/vendor/symfony/translation/Dumper/IniFileDumper.php index 75032be14..6cbdef606 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Dumper/IniFileDumper.php +++ b/data/web/inc/lib/vendor/symfony/translation/Dumper/IniFileDumper.php @@ -20,9 +20,6 @@ use Symfony\Component\Translation\MessageCatalogue; */ class IniFileDumper extends FileDumper { - /** - * {@inheritdoc} - */ public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string { $output = ''; @@ -35,9 +32,6 @@ class IniFileDumper extends FileDumper return $output; } - /** - * {@inheritdoc} - */ protected function getExtension(): string { return 'ini'; diff --git a/data/web/inc/lib/vendor/symfony/translation/Dumper/JsonFileDumper.php b/data/web/inc/lib/vendor/symfony/translation/Dumper/JsonFileDumper.php index 11027303a..e5035397f 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Dumper/JsonFileDumper.php +++ b/data/web/inc/lib/vendor/symfony/translation/Dumper/JsonFileDumper.php @@ -20,9 +20,6 @@ use Symfony\Component\Translation\MessageCatalogue; */ class JsonFileDumper extends FileDumper { - /** - * {@inheritdoc} - */ public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string { $flags = $options['json_encoding'] ?? \JSON_PRETTY_PRINT; @@ -30,9 +27,6 @@ class JsonFileDumper extends FileDumper return json_encode($messages->all($domain), $flags); } - /** - * {@inheritdoc} - */ protected function getExtension(): string { return 'json'; diff --git a/data/web/inc/lib/vendor/symfony/translation/Dumper/MoFileDumper.php b/data/web/inc/lib/vendor/symfony/translation/Dumper/MoFileDumper.php index 08c8f8997..9ded5f4ef 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Dumper/MoFileDumper.php +++ b/data/web/inc/lib/vendor/symfony/translation/Dumper/MoFileDumper.php @@ -21,9 +21,6 @@ use Symfony\Component\Translation\MessageCatalogue; */ class MoFileDumper extends FileDumper { - /** - * {@inheritdoc} - */ public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string { $sources = $targets = $sourceOffsets = $targetOffsets = ''; @@ -57,19 +54,16 @@ class MoFileDumper extends FileDumper .$this->writeLong($offset[2] + $sourcesStart + $sourcesSize); } - $output = implode('', array_map([$this, 'writeLong'], $header)) + $output = implode('', array_map($this->writeLong(...), $header)) .$sourceOffsets .$targetOffsets .$sources .$targets - ; + ; return $output; } - /** - * {@inheritdoc} - */ protected function getExtension(): string { return 'mo'; diff --git a/data/web/inc/lib/vendor/symfony/translation/Dumper/PhpFileDumper.php b/data/web/inc/lib/vendor/symfony/translation/Dumper/PhpFileDumper.php index 565d89375..51e90665d 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Dumper/PhpFileDumper.php +++ b/data/web/inc/lib/vendor/symfony/translation/Dumper/PhpFileDumper.php @@ -20,17 +20,11 @@ use Symfony\Component\Translation\MessageCatalogue; */ class PhpFileDumper extends FileDumper { - /** - * {@inheritdoc} - */ public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string { return "all($domain), true).";\n"; } - /** - * {@inheritdoc} - */ protected function getExtension(): string { return 'php'; diff --git a/data/web/inc/lib/vendor/symfony/translation/Dumper/PoFileDumper.php b/data/web/inc/lib/vendor/symfony/translation/Dumper/PoFileDumper.php index 313e50458..a2d0deb78 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Dumper/PoFileDumper.php +++ b/data/web/inc/lib/vendor/symfony/translation/Dumper/PoFileDumper.php @@ -20,9 +20,6 @@ use Symfony\Component\Translation\MessageCatalogue; */ class PoFileDumper extends FileDumper { - /** - * {@inheritdoc} - */ public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string { $output = 'msgid ""'."\n"; @@ -68,7 +65,7 @@ class PoFileDumper extends FileDumper return $output; } - private function getStandardRules(string $id) + private function getStandardRules(string $id): array { // Partly copied from TranslatorTrait::trans. $parts = []; @@ -111,9 +108,6 @@ EOF; return $standardRules; } - /** - * {@inheritdoc} - */ protected function getExtension(): string { return 'po'; diff --git a/data/web/inc/lib/vendor/symfony/translation/Dumper/QtFileDumper.php b/data/web/inc/lib/vendor/symfony/translation/Dumper/QtFileDumper.php index 819409fc0..0373e9c10 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Dumper/QtFileDumper.php +++ b/data/web/inc/lib/vendor/symfony/translation/Dumper/QtFileDumper.php @@ -20,9 +20,6 @@ use Symfony\Component\Translation\MessageCatalogue; */ class QtFileDumper extends FileDumper { - /** - * {@inheritdoc} - */ public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string { $dom = new \DOMDocument('1.0', 'utf-8'); @@ -51,9 +48,6 @@ class QtFileDumper extends FileDumper return $dom->saveXML(); } - /** - * {@inheritdoc} - */ protected function getExtension(): string { return 'ts'; diff --git a/data/web/inc/lib/vendor/symfony/translation/Dumper/XliffFileDumper.php b/data/web/inc/lib/vendor/symfony/translation/Dumper/XliffFileDumper.php index b8a109a41..d0f016b23 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Dumper/XliffFileDumper.php +++ b/data/web/inc/lib/vendor/symfony/translation/Dumper/XliffFileDumper.php @@ -21,9 +21,11 @@ use Symfony\Component\Translation\MessageCatalogue; */ class XliffFileDumper extends FileDumper { - /** - * {@inheritdoc} - */ + public function __construct( + private string $extension = 'xlf', + ) { + } + public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string { $xliffVersion = '1.2'; @@ -47,15 +49,12 @@ class XliffFileDumper extends FileDumper throw new InvalidArgumentException(sprintf('No support implemented for dumping XLIFF version "%s".', $xliffVersion)); } - /** - * {@inheritdoc} - */ protected function getExtension(): string { - return 'xlf'; + return $this->extension; } - private function dumpXliff1(string $defaultLocale, MessageCatalogue $messages, ?string $domain, array $options = []) + private function dumpXliff1(string $defaultLocale, MessageCatalogue $messages, ?string $domain, array $options = []): string { $toolInfo = ['tool-id' => 'symfony', 'tool-name' => 'Symfony']; if (\array_key_exists('tool_info', $options)) { @@ -81,6 +80,15 @@ class XliffFileDumper extends FileDumper $xliffTool->setAttribute($id, $value); } + if ($catalogueMetadata = $messages->getCatalogueMetadata('', $domain) ?? []) { + $xliffPropGroup = $xliffHead->appendChild($dom->createElement('prop-group')); + foreach ($catalogueMetadata as $key => $value) { + $xliffProp = $xliffPropGroup->appendChild($dom->createElement('prop')); + $xliffProp->setAttribute('prop-type', $key); + $xliffProp->appendChild($dom->createTextNode($value)); + } + } + $xliffBody = $xliffFile->appendChild($dom->createElement('body')); foreach ($messages->all($domain) as $source => $target) { $translation = $dom->createElement('trans-unit'); @@ -129,7 +137,7 @@ class XliffFileDumper extends FileDumper return $dom->saveXML(); } - private function dumpXliff2(string $defaultLocale, MessageCatalogue $messages, ?string $domain) + private function dumpXliff2(string $defaultLocale, MessageCatalogue $messages, ?string $domain): string { $dom = new \DOMDocument('1.0', 'utf-8'); $dom->formatOutput = true; @@ -147,6 +155,16 @@ class XliffFileDumper extends FileDumper $xliffFile->setAttribute('id', $domain.'.'.$messages->getLocale()); } + if ($catalogueMetadata = $messages->getCatalogueMetadata('', $domain) ?? []) { + $xliff->setAttribute('xmlns:m', 'urn:oasis:names:tc:xliff:metadata:2.0'); + $xliffMetadata = $xliffFile->appendChild($dom->createElement('m:metadata')); + foreach ($catalogueMetadata as $key => $value) { + $xliffMeta = $xliffMetadata->appendChild($dom->createElement('prop')); + $xliffMeta->setAttribute('type', $key); + $xliffMeta->appendChild($dom->createTextNode($value)); + } + } + foreach ($messages->all($domain) as $source => $target) { $translation = $dom->createElement('unit'); $translation->setAttribute('id', strtr(substr(base64_encode(hash('sha256', $source, true)), 0, 7), '/+', '._')); @@ -196,7 +214,7 @@ class XliffFileDumper extends FileDumper return $dom->saveXML(); } - private function hasMetadataArrayInfo(string $key, array $metadata = null): bool + private function hasMetadataArrayInfo(string $key, ?array $metadata = null): bool { return is_iterable($metadata[$key] ?? null); } diff --git a/data/web/inc/lib/vendor/symfony/translation/Dumper/YamlFileDumper.php b/data/web/inc/lib/vendor/symfony/translation/Dumper/YamlFileDumper.php index d0cfbefaa..d2670331e 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Dumper/YamlFileDumper.php +++ b/data/web/inc/lib/vendor/symfony/translation/Dumper/YamlFileDumper.php @@ -30,9 +30,6 @@ class YamlFileDumper extends FileDumper $this->extension = $extension; } - /** - * {@inheritdoc} - */ public function formatCatalogue(MessageCatalogue $messages, string $domain, array $options = []): string { if (!class_exists(Yaml::class)) { @@ -52,9 +49,6 @@ class YamlFileDumper extends FileDumper return Yaml::dump($data); } - /** - * {@inheritdoc} - */ protected function getExtension(): string { return $this->extension; diff --git a/data/web/inc/lib/vendor/symfony/translation/Exception/IncompleteDsnException.php b/data/web/inc/lib/vendor/symfony/translation/Exception/IncompleteDsnException.php index cb0ce027e..b304bde01 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Exception/IncompleteDsnException.php +++ b/data/web/inc/lib/vendor/symfony/translation/Exception/IncompleteDsnException.php @@ -13,7 +13,7 @@ namespace Symfony\Component\Translation\Exception; class IncompleteDsnException extends InvalidArgumentException { - public function __construct(string $message, string $dsn = null, \Throwable $previous = null) + public function __construct(string $message, ?string $dsn = null, ?\Throwable $previous = null) { if ($dsn) { $message = sprintf('Invalid "%s" provider DSN: ', $dsn).$message; diff --git a/data/web/inc/lib/vendor/symfony/translation/Exception/MissingRequiredOptionException.php b/data/web/inc/lib/vendor/symfony/translation/Exception/MissingRequiredOptionException.php index 2b5f80806..46152e254 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Exception/MissingRequiredOptionException.php +++ b/data/web/inc/lib/vendor/symfony/translation/Exception/MissingRequiredOptionException.php @@ -16,7 +16,7 @@ namespace Symfony\Component\Translation\Exception; */ class MissingRequiredOptionException extends IncompleteDsnException { - public function __construct(string $option, string $dsn = null, \Throwable $previous = null) + public function __construct(string $option, ?string $dsn = null, ?\Throwable $previous = null) { $message = sprintf('The option "%s" is required but missing.', $option); diff --git a/data/web/inc/lib/vendor/symfony/translation/Exception/ProviderException.php b/data/web/inc/lib/vendor/symfony/translation/Exception/ProviderException.php index 331ff7586..f2981f58b 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Exception/ProviderException.php +++ b/data/web/inc/lib/vendor/symfony/translation/Exception/ProviderException.php @@ -18,10 +18,10 @@ use Symfony\Contracts\HttpClient\ResponseInterface; */ class ProviderException extends RuntimeException implements ProviderExceptionInterface { - private $response; + private ResponseInterface $response; private string $debug; - public function __construct(string $message, ResponseInterface $response, int $code = 0, \Exception $previous = null) + public function __construct(string $message, ResponseInterface $response, int $code = 0, ?\Exception $previous = null) { $this->response = $response; $this->debug = $response->getInfo('debug') ?? ''; diff --git a/data/web/inc/lib/vendor/symfony/translation/Exception/UnsupportedSchemeException.php b/data/web/inc/lib/vendor/symfony/translation/Exception/UnsupportedSchemeException.php index 7fbaa8f04..8d3295184 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Exception/UnsupportedSchemeException.php +++ b/data/web/inc/lib/vendor/symfony/translation/Exception/UnsupportedSchemeException.php @@ -29,9 +29,13 @@ class UnsupportedSchemeException extends LogicException 'class' => Bridge\Lokalise\LokaliseProviderFactory::class, 'package' => 'symfony/lokalise-translation-provider', ], + 'phrase' => [ + 'class' => Bridge\Phrase\PhraseProviderFactory::class, + 'package' => 'symfony/phrase-translation-provider', + ], ]; - public function __construct(Dsn $dsn, string $name = null, array $supported = []) + public function __construct(Dsn $dsn, ?string $name = null, array $supported = []) { $provider = $dsn->getScheme(); if (false !== $pos = strpos($provider, '+')) { @@ -39,7 +43,7 @@ class UnsupportedSchemeException extends LogicException } $package = self::SCHEME_TO_PACKAGE_MAP[$provider] ?? null; if ($package && !class_exists($package['class'])) { - parent::__construct(sprintf('Unable to synchronize translations via "%s" as the provider is not installed; try running "composer require %s".', $provider, $package['package'])); + parent::__construct(sprintf('Unable to synchronize translations via "%s" as the provider is not installed. Try running "composer require %s".', $provider, $package['package'])); return; } diff --git a/data/web/inc/lib/vendor/symfony/translation/Extractor/ChainExtractor.php b/data/web/inc/lib/vendor/symfony/translation/Extractor/ChainExtractor.php index e58e82f05..d36f7f385 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Extractor/ChainExtractor.php +++ b/data/web/inc/lib/vendor/symfony/translation/Extractor/ChainExtractor.php @@ -29,6 +29,8 @@ class ChainExtractor implements ExtractorInterface /** * Adds a loader to the translation extractor. + * + * @return void */ public function addExtractor(string $format, ExtractorInterface $extractor) { @@ -36,7 +38,7 @@ class ChainExtractor implements ExtractorInterface } /** - * {@inheritdoc} + * @return void */ public function setPrefix(string $prefix) { @@ -46,7 +48,7 @@ class ChainExtractor implements ExtractorInterface } /** - * {@inheritdoc} + * @return void */ public function extract(string|iterable $directory, MessageCatalogue $catalogue) { diff --git a/data/web/inc/lib/vendor/symfony/translation/Extractor/ExtractorInterface.php b/data/web/inc/lib/vendor/symfony/translation/Extractor/ExtractorInterface.php index b76a7f20b..642130af7 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Extractor/ExtractorInterface.php +++ b/data/web/inc/lib/vendor/symfony/translation/Extractor/ExtractorInterface.php @@ -25,11 +25,15 @@ interface ExtractorInterface * Extracts translation messages from files, a file or a directory to the catalogue. * * @param string|iterable $resource Files, a file or a directory + * + * @return void */ public function extract(string|iterable $resource, MessageCatalogue $catalogue); /** * Sets the prefix that should be used for new found messages. + * + * @return void */ public function setPrefix(string $prefix); } diff --git a/data/web/inc/lib/vendor/symfony/translation/Extractor/PhpAstExtractor.php b/data/web/inc/lib/vendor/symfony/translation/Extractor/PhpAstExtractor.php new file mode 100644 index 000000000..06fc77de3 --- /dev/null +++ b/data/web/inc/lib/vendor/symfony/translation/Extractor/PhpAstExtractor.php @@ -0,0 +1,85 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Translation\Extractor; + +use PhpParser\NodeTraverser; +use PhpParser\NodeVisitor; +use PhpParser\Parser; +use PhpParser\ParserFactory; +use Symfony\Component\Finder\Finder; +use Symfony\Component\Translation\Extractor\Visitor\AbstractVisitor; +use Symfony\Component\Translation\MessageCatalogue; + +/** + * PhpAstExtractor extracts translation messages from a PHP AST. + * + * @author Mathieu Santostefano + */ +final class PhpAstExtractor extends AbstractFileExtractor implements ExtractorInterface +{ + private Parser $parser; + + public function __construct( + /** + * @param iterable $visitors + */ + private readonly iterable $visitors, + private string $prefix = '', + ) { + if (!class_exists(ParserFactory::class)) { + throw new \LogicException(sprintf('You cannot use "%s" as the "nikic/php-parser" package is not installed. Try running "composer require nikic/php-parser".', static::class)); + } + + $this->parser = (new ParserFactory())->createForHostVersion(); + } + + public function extract(iterable|string $resource, MessageCatalogue $catalogue): void + { + foreach ($this->extractFiles($resource) as $file) { + $traverser = new NodeTraverser(); + + // This is needed to resolve namespaces in class methods/constants. + $nameResolver = new NodeVisitor\NameResolver(); + $traverser->addVisitor($nameResolver); + + /** @var AbstractVisitor&NodeVisitor $visitor */ + foreach ($this->visitors as $visitor) { + $visitor->initialize($catalogue, $file, $this->prefix); + $traverser->addVisitor($visitor); + } + + $nodes = $this->parser->parse(file_get_contents($file)); + $traverser->traverse($nodes); + } + } + + public function setPrefix(string $prefix): void + { + $this->prefix = $prefix; + } + + protected function canBeExtracted(string $file): bool + { + return 'php' === pathinfo($file, \PATHINFO_EXTENSION) + && $this->isFile($file) + && preg_match('/\bt\(|->trans\(|TranslatableMessage|Symfony\\\\Component\\\\Validator\\\\Constraints/i', file_get_contents($file)); + } + + protected function extractFromDirectory(array|string $resource): iterable|Finder + { + if (!class_exists(Finder::class)) { + throw new \LogicException(sprintf('You cannot use "%s" as the "symfony/finder" package is not installed. Try running "composer require symfony/finder".', static::class)); + } + + return (new Finder())->files()->name('*.php')->in($resource); + } +} diff --git a/data/web/inc/lib/vendor/symfony/translation/Extractor/PhpExtractor.php b/data/web/inc/lib/vendor/symfony/translation/Extractor/PhpExtractor.php index 1b86cc591..7ff27f7c8 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Extractor/PhpExtractor.php +++ b/data/web/inc/lib/vendor/symfony/translation/Extractor/PhpExtractor.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Translation\Extractor; +trigger_deprecation('symfony/translation', '6.2', '"%s" is deprecated, use "%s" instead.', PhpExtractor::class, PhpAstExtractor::class); + use Symfony\Component\Finder\Finder; use Symfony\Component\Translation\MessageCatalogue; @@ -18,6 +20,8 @@ use Symfony\Component\Translation\MessageCatalogue; * PhpExtractor extracts translation messages from a PHP template. * * @author Michel Salib + * + * @deprecated since Symfony 6.2, use the PhpAstExtractor instead */ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface { @@ -129,7 +133,7 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface ]; /** - * {@inheritdoc} + * @return void */ public function extract(string|iterable $resource, MessageCatalogue $catalog) { @@ -142,7 +146,7 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface } /** - * {@inheritdoc} + * @return void */ public function setPrefix(string $prefix) { @@ -164,7 +168,7 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface /** * Seeks to a non-whitespace token. */ - private function seekToNextRelevantToken(\Iterator $tokenIterator) + private function seekToNextRelevantToken(\Iterator $tokenIterator): void { for (; $tokenIterator->valid(); $tokenIterator->next()) { $t = $tokenIterator->current(); @@ -174,7 +178,7 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface } } - private function skipMethodArgument(\Iterator $tokenIterator) + private function skipMethodArgument(\Iterator $tokenIterator): void { $openBraces = 0; @@ -199,7 +203,7 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface * Extracts the message from the iterator while the tokens * match allowed message tokens. */ - private function getValue(\Iterator $tokenIterator) + private function getValue(\Iterator $tokenIterator): string { $message = ''; $docToken = ''; @@ -257,6 +261,8 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface /** * Extracts trans message from PHP tokens. + * + * @return void */ protected function parseTokens(array $tokens, MessageCatalogue $catalog, string $filename) { @@ -314,9 +320,6 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface return $this->isFile($file) && 'php' === pathinfo($file, \PATHINFO_EXTENSION); } - /** - * {@inheritdoc} - */ protected function extractFromDirectory(string|array $directory): iterable { if (!class_exists(Finder::class)) { diff --git a/data/web/inc/lib/vendor/symfony/translation/Extractor/PhpStringTokenParser.php b/data/web/inc/lib/vendor/symfony/translation/Extractor/PhpStringTokenParser.php index 7fbd37c68..2dfc1e387 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Extractor/PhpStringTokenParser.php +++ b/data/web/inc/lib/vendor/symfony/translation/Extractor/PhpStringTokenParser.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Translation\Extractor; +trigger_deprecation('symfony/translation', '6.2', '"%s" is deprecated.', PhpStringTokenParser::class); + /* * The following is derived from code at http://github.com/nikic/PHP-Parser * @@ -47,6 +49,9 @@ namespace Symfony\Component\Translation\Extractor; * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/** + * @deprecated since Symfony 6.2 + */ class PhpStringTokenParser { protected static $replacements = [ @@ -89,7 +94,7 @@ class PhpStringTokenParser * @param string $str String without quotes * @param string|null $quote Quote type */ - public static function parseEscapeSequences(string $str, string $quote = null): string + public static function parseEscapeSequences(string $str, ?string $quote = null): string { if (null !== $quote) { $str = str_replace('\\'.$quote, $quote, $str); diff --git a/data/web/inc/lib/vendor/symfony/translation/Extractor/Visitor/AbstractVisitor.php b/data/web/inc/lib/vendor/symfony/translation/Extractor/Visitor/AbstractVisitor.php new file mode 100644 index 000000000..c33689616 --- /dev/null +++ b/data/web/inc/lib/vendor/symfony/translation/Extractor/Visitor/AbstractVisitor.php @@ -0,0 +1,135 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Translation\Extractor\Visitor; + +use PhpParser\Node; +use Symfony\Component\Translation\MessageCatalogue; + +/** + * @author Mathieu Santostefano + */ +abstract class AbstractVisitor +{ + private MessageCatalogue $catalogue; + private \SplFileInfo $file; + private string $messagePrefix; + + public function initialize(MessageCatalogue $catalogue, \SplFileInfo $file, string $messagePrefix): void + { + $this->catalogue = $catalogue; + $this->file = $file; + $this->messagePrefix = $messagePrefix; + } + + protected function addMessageToCatalogue(string $message, ?string $domain, int $line): void + { + $domain ??= 'messages'; + $this->catalogue->set($message, $this->messagePrefix.$message, $domain); + $metadata = $this->catalogue->getMetadata($message, $domain) ?? []; + $normalizedFilename = preg_replace('{[\\\\/]+}', '/', $this->file); + $metadata['sources'][] = $normalizedFilename.':'.$line; + $this->catalogue->setMetadata($message, $metadata, $domain); + } + + protected function getStringArguments(Node\Expr\CallLike|Node\Attribute|Node\Expr\New_ $node, int|string $index, bool $indexIsRegex = false): array + { + if (\is_string($index)) { + return $this->getStringNamedArguments($node, $index, $indexIsRegex); + } + + $args = $node instanceof Node\Expr\CallLike ? $node->getRawArgs() : $node->args; + + if (!($arg = $args[$index] ?? null) instanceof Node\Arg) { + return []; + } + + return (array) $this->getStringValue($arg->value); + } + + protected function hasNodeNamedArguments(Node\Expr\CallLike|Node\Attribute|Node\Expr\New_ $node): bool + { + $args = $node instanceof Node\Expr\CallLike ? $node->getRawArgs() : $node->args; + + foreach ($args as $arg) { + if ($arg instanceof Node\Arg && null !== $arg->name) { + return true; + } + } + + return false; + } + + protected function nodeFirstNamedArgumentIndex(Node\Expr\CallLike|Node\Attribute|Node\Expr\New_ $node): int + { + $args = $node instanceof Node\Expr\CallLike ? $node->getRawArgs() : $node->args; + + foreach ($args as $i => $arg) { + if ($arg instanceof Node\Arg && null !== $arg->name) { + return $i; + } + } + + return \PHP_INT_MAX; + } + + private function getStringNamedArguments(Node\Expr\CallLike|Node\Attribute $node, ?string $argumentName = null, bool $isArgumentNamePattern = false): array + { + $args = $node instanceof Node\Expr\CallLike ? $node->getArgs() : $node->args; + $argumentValues = []; + + foreach ($args as $arg) { + if (!$isArgumentNamePattern && $arg->name?->toString() === $argumentName) { + $argumentValues[] = $this->getStringValue($arg->value); + } elseif ($isArgumentNamePattern && preg_match($argumentName, $arg->name?->toString() ?? '') > 0) { + $argumentValues[] = $this->getStringValue($arg->value); + } + } + + return array_filter($argumentValues); + } + + private function getStringValue(Node $node): ?string + { + if ($node instanceof Node\Scalar\String_) { + return $node->value; + } + + if ($node instanceof Node\Expr\BinaryOp\Concat) { + if (null === $left = $this->getStringValue($node->left)) { + return null; + } + + if (null === $right = $this->getStringValue($node->right)) { + return null; + } + + return $left.$right; + } + + if ($node instanceof Node\Expr\Assign && $node->expr instanceof Node\Scalar\String_) { + return $node->expr->value; + } + + if ($node instanceof Node\Expr\ClassConstFetch) { + try { + $reflection = new \ReflectionClass($node->class->toString()); + $constant = $reflection->getReflectionConstant($node->name->toString()); + if (false !== $constant && \is_string($constant->getValue())) { + return $constant->getValue(); + } + } catch (\ReflectionException) { + } + } + + return null; + } +} diff --git a/data/web/inc/lib/vendor/symfony/translation/Extractor/Visitor/ConstraintVisitor.php b/data/web/inc/lib/vendor/symfony/translation/Extractor/Visitor/ConstraintVisitor.php new file mode 100644 index 000000000..00fb9eedc --- /dev/null +++ b/data/web/inc/lib/vendor/symfony/translation/Extractor/Visitor/ConstraintVisitor.php @@ -0,0 +1,112 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Translation\Extractor\Visitor; + +use PhpParser\Node; +use PhpParser\NodeVisitor; + +/** + * @author Mathieu Santostefano + * + * Code mostly comes from https://github.com/php-translation/extractor/blob/master/src/Visitor/Php/Symfony/Constraint.php + */ +final class ConstraintVisitor extends AbstractVisitor implements NodeVisitor +{ + public function __construct( + private readonly array $constraintClassNames = [] + ) { + } + + public function beforeTraverse(array $nodes): ?Node + { + return null; + } + + public function enterNode(Node $node): ?Node + { + return null; + } + + public function leaveNode(Node $node): ?Node + { + if (!$node instanceof Node\Expr\New_ && !$node instanceof Node\Attribute) { + return null; + } + + $className = $node instanceof Node\Attribute ? $node->name : $node->class; + if (!$className instanceof Node\Name) { + return null; + } + + $parts = $className->getParts(); + $isConstraintClass = false; + + foreach ($parts as $part) { + if (\in_array($part, $this->constraintClassNames, true)) { + $isConstraintClass = true; + + break; + } + } + + if (!$isConstraintClass) { + return null; + } + + $arg = $node->args[0] ?? null; + if (!$arg instanceof Node\Arg) { + return null; + } + + if ($this->hasNodeNamedArguments($node)) { + $messages = $this->getStringArguments($node, '/message/i', true); + } else { + if (!$arg->value instanceof Node\Expr\Array_) { + // There is no way to guess which argument is a message to be translated. + return null; + } + + $messages = []; + $options = $arg->value; + + /** @var Node\Expr\ArrayItem $item */ + foreach ($options->items as $item) { + if (!$item->key instanceof Node\Scalar\String_) { + continue; + } + + if (false === stripos($item->key->value ?? '', 'message')) { + continue; + } + + if (!$item->value instanceof Node\Scalar\String_) { + continue; + } + + $messages[] = $item->value->value; + + break; + } + } + + foreach ($messages as $message) { + $this->addMessageToCatalogue($message, 'validators', $node->getStartLine()); + } + + return null; + } + + public function afterTraverse(array $nodes): ?Node + { + return null; + } +} diff --git a/data/web/inc/lib/vendor/symfony/translation/Extractor/Visitor/TransMethodVisitor.php b/data/web/inc/lib/vendor/symfony/translation/Extractor/Visitor/TransMethodVisitor.php new file mode 100644 index 000000000..53a6981a2 --- /dev/null +++ b/data/web/inc/lib/vendor/symfony/translation/Extractor/Visitor/TransMethodVisitor.php @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Translation\Extractor\Visitor; + +use PhpParser\Node; +use PhpParser\NodeVisitor; + +/** + * @author Mathieu Santostefano + */ +final class TransMethodVisitor extends AbstractVisitor implements NodeVisitor +{ + public function beforeTraverse(array $nodes): ?Node + { + return null; + } + + public function enterNode(Node $node): ?Node + { + return null; + } + + public function leaveNode(Node $node): ?Node + { + if (!$node instanceof Node\Expr\MethodCall && !$node instanceof Node\Expr\FuncCall) { + return null; + } + + if (!\is_string($node->name) && !$node->name instanceof Node\Identifier && !$node->name instanceof Node\Name) { + return null; + } + + $name = (string) $node->name; + + if ('trans' === $name || 't' === $name) { + $firstNamedArgumentIndex = $this->nodeFirstNamedArgumentIndex($node); + + if (!$messages = $this->getStringArguments($node, 0 < $firstNamedArgumentIndex ? 0 : 'message')) { + return null; + } + + $domain = $this->getStringArguments($node, 2 < $firstNamedArgumentIndex ? 2 : 'domain')[0] ?? null; + + foreach ($messages as $message) { + $this->addMessageToCatalogue($message, $domain, $node->getStartLine()); + } + } + + return null; + } + + public function afterTraverse(array $nodes): ?Node + { + return null; + } +} diff --git a/data/web/inc/lib/vendor/symfony/translation/Extractor/Visitor/TranslatableMessageVisitor.php b/data/web/inc/lib/vendor/symfony/translation/Extractor/Visitor/TranslatableMessageVisitor.php new file mode 100644 index 000000000..6bd8bb022 --- /dev/null +++ b/data/web/inc/lib/vendor/symfony/translation/Extractor/Visitor/TranslatableMessageVisitor.php @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Translation\Extractor\Visitor; + +use PhpParser\Node; +use PhpParser\NodeVisitor; + +/** + * @author Mathieu Santostefano + */ +final class TranslatableMessageVisitor extends AbstractVisitor implements NodeVisitor +{ + public function beforeTraverse(array $nodes): ?Node + { + return null; + } + + public function enterNode(Node $node): ?Node + { + return null; + } + + public function leaveNode(Node $node): ?Node + { + if (!$node instanceof Node\Expr\New_) { + return null; + } + + if (!($className = $node->class) instanceof Node\Name) { + return null; + } + + if (!\in_array('TranslatableMessage', $className->getParts(), true)) { + return null; + } + + $firstNamedArgumentIndex = $this->nodeFirstNamedArgumentIndex($node); + + if (!$messages = $this->getStringArguments($node, 0 < $firstNamedArgumentIndex ? 0 : 'message')) { + return null; + } + + $domain = $this->getStringArguments($node, 2 < $firstNamedArgumentIndex ? 2 : 'domain')[0] ?? null; + + foreach ($messages as $message) { + $this->addMessageToCatalogue($message, $domain, $node->getStartLine()); + } + + return null; + } + + public function afterTraverse(array $nodes): ?Node + { + return null; + } +} diff --git a/data/web/inc/lib/vendor/symfony/translation/Formatter/IntlFormatter.php b/data/web/inc/lib/vendor/symfony/translation/Formatter/IntlFormatter.php index f7f1c36a2..e62de253f 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Formatter/IntlFormatter.php +++ b/data/web/inc/lib/vendor/symfony/translation/Formatter/IntlFormatter.php @@ -20,12 +20,9 @@ use Symfony\Component\Translation\Exception\LogicException; */ class IntlFormatter implements IntlFormatterInterface { - private $hasMessageFormatter; - private $cache = []; + private bool $hasMessageFormatter; + private array $cache = []; - /** - * {@inheritdoc} - */ public function formatIntl(string $message, string $locale, array $parameters = []): string { // MessageFormatter constructor throws an exception if the message is empty @@ -34,7 +31,7 @@ class IntlFormatter implements IntlFormatterInterface } if (!$formatter = $this->cache[$locale][$message] ?? null) { - if (!($this->hasMessageFormatter ?? $this->hasMessageFormatter = class_exists(\MessageFormatter::class))) { + if (!$this->hasMessageFormatter ??= class_exists(\MessageFormatter::class)) { throw new LogicException('Cannot parse message translation: please install the "intl" PHP extension or the "symfony/polyfill-intl-messageformatter" package.'); } try { diff --git a/data/web/inc/lib/vendor/symfony/translation/Formatter/MessageFormatter.php b/data/web/inc/lib/vendor/symfony/translation/Formatter/MessageFormatter.php index 68821b1d0..d5255bdcb 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Formatter/MessageFormatter.php +++ b/data/web/inc/lib/vendor/symfony/translation/Formatter/MessageFormatter.php @@ -22,33 +22,23 @@ class_exists(IntlFormatter::class); */ class MessageFormatter implements MessageFormatterInterface, IntlFormatterInterface { - private $translator; - private $intlFormatter; + private TranslatorInterface $translator; + private IntlFormatterInterface $intlFormatter; /** * @param TranslatorInterface|null $translator An identity translator to use as selector for pluralization */ - public function __construct(TranslatorInterface $translator = null, IntlFormatterInterface $intlFormatter = null) + public function __construct(?TranslatorInterface $translator = null, ?IntlFormatterInterface $intlFormatter = null) { $this->translator = $translator ?? new IdentityTranslator(); $this->intlFormatter = $intlFormatter ?? new IntlFormatter(); } - /** - * {@inheritdoc} - */ public function format(string $message, string $locale, array $parameters = []): string { - if ($this->translator instanceof TranslatorInterface) { - return $this->translator->trans($message, $parameters, null, $locale); - } - - return strtr($message, $parameters); + return $this->translator->trans($message, $parameters, null, $locale); } - /** - * {@inheritdoc} - */ public function formatIntl(string $message, string $locale, array $parameters = []): string { return $this->intlFormatter->formatIntl($message, $locale, $parameters); diff --git a/data/web/inc/lib/vendor/symfony/translation/LICENSE b/data/web/inc/lib/vendor/symfony/translation/LICENSE index 88bf75bb4..0138f8f07 100644 --- a/data/web/inc/lib/vendor/symfony/translation/LICENSE +++ b/data/web/inc/lib/vendor/symfony/translation/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2022 Fabien Potencier +Copyright (c) 2004-present Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/data/web/inc/lib/vendor/symfony/translation/Loader/ArrayLoader.php b/data/web/inc/lib/vendor/symfony/translation/Loader/ArrayLoader.php index 35de9ef54..e63a7d05b 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Loader/ArrayLoader.php +++ b/data/web/inc/lib/vendor/symfony/translation/Loader/ArrayLoader.php @@ -20,9 +20,6 @@ use Symfony\Component\Translation\MessageCatalogue; */ class ArrayLoader implements LoaderInterface { - /** - * {@inheritdoc} - */ public function load(mixed $resource, string $locale, string $domain = 'messages'): MessageCatalogue { $resource = $this->flatten($resource); @@ -46,9 +43,11 @@ class ArrayLoader implements LoaderInterface foreach ($messages as $key => $value) { if (\is_array($value)) { foreach ($this->flatten($value) as $k => $v) { - $result[$key.'.'.$k] = $v; + if (null !== $v) { + $result[$key.'.'.$k] = $v; + } } - } else { + } elseif (null !== $value) { $result[$key] = $value; } } diff --git a/data/web/inc/lib/vendor/symfony/translation/Loader/CsvFileLoader.php b/data/web/inc/lib/vendor/symfony/translation/Loader/CsvFileLoader.php index 76b00b151..7f2f96be6 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Loader/CsvFileLoader.php +++ b/data/web/inc/lib/vendor/symfony/translation/Loader/CsvFileLoader.php @@ -24,9 +24,6 @@ class CsvFileLoader extends FileLoader private string $enclosure = '"'; private string $escape = '\\'; - /** - * {@inheritdoc} - */ protected function loadResource(string $resource): array { $messages = []; @@ -45,7 +42,7 @@ class CsvFileLoader extends FileLoader continue; } - if ('#' !== substr($data[0], 0, 1) && isset($data[1]) && 2 === \count($data)) { + if (!str_starts_with($data[0], '#') && isset($data[1]) && 2 === \count($data)) { $messages[$data[0]] = $data[1]; } } @@ -55,6 +52,8 @@ class CsvFileLoader extends FileLoader /** * Sets the delimiter, enclosure, and escape character for CSV. + * + * @return void */ public function setCsvControl(string $delimiter = ';', string $enclosure = '"', string $escape = '\\') { diff --git a/data/web/inc/lib/vendor/symfony/translation/Loader/FileLoader.php b/data/web/inc/lib/vendor/symfony/translation/Loader/FileLoader.php index e170d7617..877c3bbc7 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Loader/FileLoader.php +++ b/data/web/inc/lib/vendor/symfony/translation/Loader/FileLoader.php @@ -21,9 +21,6 @@ use Symfony\Component\Translation\MessageCatalogue; */ abstract class FileLoader extends ArrayLoader { - /** - * {@inheritdoc} - */ public function load(mixed $resource, string $locale, string $domain = 'messages'): MessageCatalogue { if (!stream_is_local($resource)) { @@ -37,9 +34,7 @@ abstract class FileLoader extends ArrayLoader $messages = $this->loadResource($resource); // empty resource - if (null === $messages) { - $messages = []; - } + $messages ??= []; // not an array if (!\is_array($messages)) { diff --git a/data/web/inc/lib/vendor/symfony/translation/Loader/IcuDatFileLoader.php b/data/web/inc/lib/vendor/symfony/translation/Loader/IcuDatFileLoader.php index c3ca5fd08..76e4e7f02 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Loader/IcuDatFileLoader.php +++ b/data/web/inc/lib/vendor/symfony/translation/Loader/IcuDatFileLoader.php @@ -23,9 +23,6 @@ use Symfony\Component\Translation\MessageCatalogue; */ class IcuDatFileLoader extends IcuResFileLoader { - /** - * {@inheritdoc} - */ public function load(mixed $resource, string $locale, string $domain = 'messages'): MessageCatalogue { if (!stream_is_local($resource.'.dat')) { @@ -38,7 +35,7 @@ class IcuDatFileLoader extends IcuResFileLoader try { $rb = new \ResourceBundle($locale, $resource); - } catch (\Exception $e) { + } catch (\Exception) { $rb = null; } diff --git a/data/web/inc/lib/vendor/symfony/translation/Loader/IcuResFileLoader.php b/data/web/inc/lib/vendor/symfony/translation/Loader/IcuResFileLoader.php index 54c48f813..949dd9792 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Loader/IcuResFileLoader.php +++ b/data/web/inc/lib/vendor/symfony/translation/Loader/IcuResFileLoader.php @@ -23,9 +23,6 @@ use Symfony\Component\Translation\MessageCatalogue; */ class IcuResFileLoader implements LoaderInterface { - /** - * {@inheritdoc} - */ public function load(mixed $resource, string $locale, string $domain = 'messages'): MessageCatalogue { if (!stream_is_local($resource)) { @@ -38,7 +35,7 @@ class IcuResFileLoader implements LoaderInterface try { $rb = new \ResourceBundle($locale, $resource); - } catch (\Exception $e) { + } catch (\Exception) { $rb = null; } @@ -71,9 +68,9 @@ class IcuResFileLoader implements LoaderInterface * * @param \ResourceBundle $rb The ResourceBundle that will be flattened * @param array $messages Used internally for recursive calls - * @param string $path Current path being parsed, used internally for recursive calls + * @param string|null $path Current path being parsed, used internally for recursive calls */ - protected function flatten(\ResourceBundle $rb, array &$messages = [], string $path = null): array + protected function flatten(\ResourceBundle $rb, array &$messages = [], ?string $path = null): array { foreach ($rb as $key => $value) { $nodePath = $path ? $path.'.'.$key : $key; diff --git a/data/web/inc/lib/vendor/symfony/translation/Loader/IniFileLoader.php b/data/web/inc/lib/vendor/symfony/translation/Loader/IniFileLoader.php index 04e294d11..3126896c8 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Loader/IniFileLoader.php +++ b/data/web/inc/lib/vendor/symfony/translation/Loader/IniFileLoader.php @@ -18,9 +18,6 @@ namespace Symfony\Component\Translation\Loader; */ class IniFileLoader extends FileLoader { - /** - * {@inheritdoc} - */ protected function loadResource(string $resource): array { return parse_ini_file($resource, true); diff --git a/data/web/inc/lib/vendor/symfony/translation/Loader/JsonFileLoader.php b/data/web/inc/lib/vendor/symfony/translation/Loader/JsonFileLoader.php index 67a8d58ed..385553ef6 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Loader/JsonFileLoader.php +++ b/data/web/inc/lib/vendor/symfony/translation/Loader/JsonFileLoader.php @@ -20,9 +20,6 @@ use Symfony\Component\Translation\Exception\InvalidResourceException; */ class JsonFileLoader extends FileLoader { - /** - * {@inheritdoc} - */ protected function loadResource(string $resource): array { $messages = []; @@ -42,19 +39,13 @@ class JsonFileLoader extends FileLoader */ private function getJSONErrorMessage(int $errorCode): string { - switch ($errorCode) { - case \JSON_ERROR_DEPTH: - return 'Maximum stack depth exceeded'; - case \JSON_ERROR_STATE_MISMATCH: - return 'Underflow or the modes mismatch'; - case \JSON_ERROR_CTRL_CHAR: - return 'Unexpected control character found'; - case \JSON_ERROR_SYNTAX: - return 'Syntax error, malformed JSON'; - case \JSON_ERROR_UTF8: - return 'Malformed UTF-8 characters, possibly incorrectly encoded'; - default: - return 'Unknown error'; - } + return match ($errorCode) { + \JSON_ERROR_DEPTH => 'Maximum stack depth exceeded', + \JSON_ERROR_STATE_MISMATCH => 'Underflow or the modes mismatch', + \JSON_ERROR_CTRL_CHAR => 'Unexpected control character found', + \JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON', + \JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded', + default => 'Unknown error', + }; } } diff --git a/data/web/inc/lib/vendor/symfony/translation/Loader/MoFileLoader.php b/data/web/inc/lib/vendor/symfony/translation/Loader/MoFileLoader.php index b0c891387..8427c393e 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Loader/MoFileLoader.php +++ b/data/web/inc/lib/vendor/symfony/translation/Loader/MoFileLoader.php @@ -38,8 +38,6 @@ class MoFileLoader extends FileLoader /** * Parses machine object (MO) format, independent of the machine's endian it * was created on. Both 32bit and 64bit systems are supported. - * - * {@inheritdoc} */ protected function loadResource(string $resource): array { diff --git a/data/web/inc/lib/vendor/symfony/translation/Loader/PhpFileLoader.php b/data/web/inc/lib/vendor/symfony/translation/Loader/PhpFileLoader.php index 6bc2a05f1..541b6c832 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Loader/PhpFileLoader.php +++ b/data/web/inc/lib/vendor/symfony/translation/Loader/PhpFileLoader.php @@ -20,12 +20,9 @@ class PhpFileLoader extends FileLoader { private static ?array $cache = []; - /** - * {@inheritdoc} - */ protected function loadResource(string $resource): array { - if ([] === self::$cache && \function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN) && (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) || filter_var(ini_get('opcache.enable_cli'), \FILTER_VALIDATE_BOOLEAN))) { + if ([] === self::$cache && \function_exists('opcache_invalidate') && filter_var(\ini_get('opcache.enable'), \FILTER_VALIDATE_BOOL) && (!\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) || filter_var(\ini_get('opcache.enable_cli'), \FILTER_VALIDATE_BOOL))) { self::$cache = null; } @@ -33,10 +30,6 @@ class PhpFileLoader extends FileLoader return require $resource; } - if (isset(self::$cache[$resource])) { - return self::$cache[$resource]; - } - - return self::$cache[$resource] = require $resource; + return self::$cache[$resource] ??= require $resource; } } diff --git a/data/web/inc/lib/vendor/symfony/translation/Loader/PoFileLoader.php b/data/web/inc/lib/vendor/symfony/translation/Loader/PoFileLoader.php index 6df161487..620d97339 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Loader/PoFileLoader.php +++ b/data/web/inc/lib/vendor/symfony/translation/Loader/PoFileLoader.php @@ -57,8 +57,6 @@ class PoFileLoader extends FileLoader * - Message IDs are allowed to have other encodings as just US-ASCII. * * Items with an empty id are ignored. - * - * {@inheritdoc} */ protected function loadResource(string $resource): array { @@ -83,15 +81,15 @@ class PoFileLoader extends FileLoader } $item = $defaults; $flags = []; - } elseif ('#,' === substr($line, 0, 2)) { + } elseif (str_starts_with($line, '#,')) { $flags = array_map('trim', explode(',', substr($line, 2))); - } elseif ('msgid "' === substr($line, 0, 7)) { + } elseif (str_starts_with($line, 'msgid "')) { // We start a new msg so save previous // TODO: this fails when comments or contexts are added $this->addMessage($messages, $item); $item = $defaults; $item['ids']['singular'] = substr($line, 7, -1); - } elseif ('msgstr "' === substr($line, 0, 8)) { + } elseif (str_starts_with($line, 'msgstr "')) { $item['translated'] = substr($line, 8, -1); } elseif ('"' === $line[0]) { $continues = isset($item['translated']) ? 'translated' : 'ids'; @@ -102,9 +100,9 @@ class PoFileLoader extends FileLoader } else { $item[$continues] .= substr($line, 1, -1); } - } elseif ('msgid_plural "' === substr($line, 0, 14)) { + } elseif (str_starts_with($line, 'msgid_plural "')) { $item['ids']['plural'] = substr($line, 14, -1); - } elseif ('msgstr[' === substr($line, 0, 7)) { + } elseif (str_starts_with($line, 'msgstr[')) { $size = strpos($line, ']'); $item['translated'][(int) substr($line, 7, 1)] = substr($line, $size + 3, -1); } @@ -124,7 +122,7 @@ class PoFileLoader extends FileLoader * A .po file could contain by error missing plural indexes. We need to * fix these before saving them. */ - private function addMessage(array &$messages, array $item) + private function addMessage(array &$messages, array $item): void { if (!empty($item['ids']['singular'])) { $id = stripcslashes($item['ids']['singular']); diff --git a/data/web/inc/lib/vendor/symfony/translation/Loader/QtFileLoader.php b/data/web/inc/lib/vendor/symfony/translation/Loader/QtFileLoader.php index 6d5582d66..235f85ee9 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Loader/QtFileLoader.php +++ b/data/web/inc/lib/vendor/symfony/translation/Loader/QtFileLoader.php @@ -25,9 +25,6 @@ use Symfony\Component\Translation\MessageCatalogue; */ class QtFileLoader implements LoaderInterface { - /** - * {@inheritdoc} - */ public function load(mixed $resource, string $locale, string $domain = 'messages'): MessageCatalogue { if (!class_exists(XmlUtils::class)) { @@ -67,7 +64,6 @@ class QtFileLoader implements LoaderInterface $domain ); } - $translation = $translation->nextSibling; } if (class_exists(FileResource::class)) { diff --git a/data/web/inc/lib/vendor/symfony/translation/Loader/XliffFileLoader.php b/data/web/inc/lib/vendor/symfony/translation/Loader/XliffFileLoader.php index 670e19979..31b3251ba 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Loader/XliffFileLoader.php +++ b/data/web/inc/lib/vendor/symfony/translation/Loader/XliffFileLoader.php @@ -28,9 +28,6 @@ use Symfony\Component\Translation\Util\XliffUtils; */ class XliffFileLoader implements LoaderInterface { - /** - * {@inheritdoc} - */ public function load(mixed $resource, string $locale, string $domain = 'messages'): MessageCatalogue { if (!class_exists(XmlUtils::class)) { @@ -75,7 +72,7 @@ class XliffFileLoader implements LoaderInterface return $catalogue; } - private function extract(\DOMDocument $dom, MessageCatalogue $catalogue, string $domain) + private function extract(\DOMDocument $dom, MessageCatalogue $catalogue, string $domain): void { $xliffVersion = XliffUtils::getVersionNumber($dom); @@ -91,7 +88,7 @@ class XliffFileLoader implements LoaderInterface /** * Extract messages and metadata from DOMDocument into a MessageCatalogue. */ - private function extractXliff1(\DOMDocument $dom, MessageCatalogue $catalogue, string $domain) + private function extractXliff1(\DOMDocument $dom, MessageCatalogue $catalogue, string $domain): void { $xml = simplexml_import_dom($dom); $encoding = $dom->encoding ? strtoupper($dom->encoding) : null; @@ -104,6 +101,10 @@ class XliffFileLoader implements LoaderInterface $file->registerXPathNamespace('xliff', $namespace); + foreach ($file->xpath('.//xliff:prop') as $prop) { + $catalogue->setCatalogueMetadata($prop->attributes()['prop-type'], (string) $prop, $domain); + } + foreach ($file->xpath('.//xliff:trans-unit') as $translation) { $attributes = $translation->attributes(); @@ -111,6 +112,10 @@ class XliffFileLoader implements LoaderInterface continue; } + if (isset($translation->target) && 'needs-translation' === (string) $translation->target->attributes()['state']) { + continue; + } + $source = isset($attributes['resname']) && $attributes['resname'] ? $attributes['resname'] : $translation->source; // If the xlf file has another encoding specified, try to convert it because // simple_xml will always return utf-8 encoded values @@ -144,7 +149,7 @@ class XliffFileLoader implements LoaderInterface } } - private function extractXliff2(\DOMDocument $dom, MessageCatalogue $catalogue, string $domain) + private function extractXliff2(\DOMDocument $dom, MessageCatalogue $catalogue, string $domain): void { $xml = simplexml_import_dom($dom); $encoding = $dom->encoding ? strtoupper($dom->encoding) : null; @@ -190,7 +195,7 @@ class XliffFileLoader implements LoaderInterface /** * Convert a UTF8 string to the specified encoding. */ - private function utf8ToCharset(string $content, string $encoding = null): string + private function utf8ToCharset(string $content, ?string $encoding = null): string { if ('UTF-8' !== $encoding && !empty($encoding)) { return mb_convert_encoding($content, $encoding, 'UTF-8'); @@ -199,7 +204,7 @@ class XliffFileLoader implements LoaderInterface return $content; } - private function parseNotesMetadata(\SimpleXMLElement $noteElement = null, string $encoding = null): array + private function parseNotesMetadata(?\SimpleXMLElement $noteElement = null, ?string $encoding = null): array { $notes = []; @@ -227,6 +232,6 @@ class XliffFileLoader implements LoaderInterface private function isXmlString(string $resource): bool { - return 0 === strpos($resource, 'yamlParser) { + if (!isset($this->yamlParser)) { if (!class_exists(\Symfony\Component\Yaml\Parser::class)) { throw new LogicException('Loading translations from the YAML format requires the Symfony Yaml component.'); } diff --git a/data/web/inc/lib/vendor/symfony/translation/LocaleSwitcher.php b/data/web/inc/lib/vendor/symfony/translation/LocaleSwitcher.php new file mode 100644 index 000000000..c07809c58 --- /dev/null +++ b/data/web/inc/lib/vendor/symfony/translation/LocaleSwitcher.php @@ -0,0 +1,78 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Translation; + +use Symfony\Component\Routing\RequestContext; +use Symfony\Contracts\Translation\LocaleAwareInterface; + +/** + * @author Kevin Bond + */ +class LocaleSwitcher implements LocaleAwareInterface +{ + private string $defaultLocale; + + /** + * @param LocaleAwareInterface[] $localeAwareServices + */ + public function __construct( + private string $locale, + private iterable $localeAwareServices, + private ?RequestContext $requestContext = null, + ) { + $this->defaultLocale = $locale; + } + + public function setLocale(string $locale): void + { + if (class_exists(\Locale::class)) { + \Locale::setDefault($locale); + } + $this->locale = $locale; + $this->requestContext?->setParameter('_locale', $locale); + + foreach ($this->localeAwareServices as $service) { + $service->setLocale($locale); + } + } + + public function getLocale(): string + { + return $this->locale; + } + + /** + * Switch to a new locale, execute a callback, then switch back to the original. + * + * @template T + * + * @param callable(string $locale):T $callback + * + * @return T + */ + public function runWithLocale(string $locale, callable $callback): mixed + { + $original = $this->getLocale(); + $this->setLocale($locale); + + try { + return $callback($locale); + } finally { + $this->setLocale($original); + } + } + + public function reset(): void + { + $this->setLocale($this->defaultLocale); + } +} diff --git a/data/web/inc/lib/vendor/symfony/translation/LoggingTranslator.php b/data/web/inc/lib/vendor/symfony/translation/LoggingTranslator.php index 8c8441cdf..4a560bd6a 100644 --- a/data/web/inc/lib/vendor/symfony/translation/LoggingTranslator.php +++ b/data/web/inc/lib/vendor/symfony/translation/LoggingTranslator.php @@ -21,8 +21,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; */ class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface, LocaleAwareInterface { - private $translator; - private $logger; + private TranslatorInterface $translator; + private LoggerInterface $logger; /** * @param TranslatorInterface&TranslatorBagInterface&LocaleAwareInterface $translator The translator must implement TranslatorBagInterface @@ -37,10 +37,7 @@ class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface, $this->logger = $logger; } - /** - * {@inheritdoc} - */ - public function trans(?string $id, array $parameters = [], string $domain = null, string $locale = null): string + public function trans(?string $id, array $parameters = [], ?string $domain = null, ?string $locale = null): string { $trans = $this->translator->trans($id = (string) $id, $parameters, $domain, $locale); $this->log($id, $domain, $locale); @@ -49,7 +46,7 @@ class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface, } /** - * {@inheritdoc} + * @return void */ public function setLocale(string $locale) { @@ -62,25 +59,16 @@ class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface, $this->logger->debug(sprintf('The locale of the translator has changed from "%s" to "%s".', $prev, $locale)); } - /** - * {@inheritdoc} - */ public function getLocale(): string { return $this->translator->getLocale(); } - /** - * {@inheritdoc} - */ - public function getCatalogue(string $locale = null): MessageCatalogueInterface + public function getCatalogue(?string $locale = null): MessageCatalogueInterface { return $this->translator->getCatalogue($locale); } - /** - * {@inheritdoc} - */ public function getCatalogues(): array { return $this->translator->getCatalogues(); @@ -99,7 +87,7 @@ class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface, } /** - * Passes through all unknown calls onto the translator object. + * @return mixed */ public function __call(string $method, array $args) { @@ -109,11 +97,9 @@ class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface, /** * Logs for missing translations. */ - private function log(string $id, ?string $domain, ?string $locale) + private function log(string $id, ?string $domain, ?string $locale): void { - if (null === $domain) { - $domain = 'messages'; - } + $domain ??= 'messages'; $catalogue = $this->translator->getCatalogue($locale); if ($catalogue->defines($id, $domain)) { diff --git a/data/web/inc/lib/vendor/symfony/translation/MessageCatalogue.php b/data/web/inc/lib/vendor/symfony/translation/MessageCatalogue.php index 7aa27efda..d56f04393 100644 --- a/data/web/inc/lib/vendor/symfony/translation/MessageCatalogue.php +++ b/data/web/inc/lib/vendor/symfony/translation/MessageCatalogue.php @@ -17,13 +17,14 @@ use Symfony\Component\Translation\Exception\LogicException; /** * @author Fabien Potencier */ -class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterface +class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterface, CatalogueMetadataAwareInterface { private array $messages = []; private array $metadata = []; + private array $catalogueMetadata = []; private array $resources = []; private string $locale; - private $fallbackCatalogue = null; + private ?MessageCatalogueInterface $fallbackCatalogue = null; private ?self $parent = null; /** @@ -35,17 +36,11 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf $this->messages = $messages; } - /** - * {@inheritdoc} - */ public function getLocale(): string { return $this->locale; } - /** - * {@inheritdoc} - */ public function getDomains(): array { $domains = []; @@ -60,10 +55,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf return array_values($domains); } - /** - * {@inheritdoc} - */ - public function all(string $domain = null): array + public function all(?string $domain = null): array { if (null !== $domain) { // skip messages merge if intl-icu requested explicitly @@ -89,16 +81,13 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf } /** - * {@inheritdoc} + * @return void */ public function set(string $id, string $translation, string $domain = 'messages') { $this->add([$id => $translation], $domain); } - /** - * {@inheritdoc} - */ public function has(string $id, string $domain = 'messages'): bool { if (isset($this->messages[$domain][$id]) || isset($this->messages[$domain.self::INTL_DOMAIN_SUFFIX][$id])) { @@ -112,17 +101,11 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf return false; } - /** - * {@inheritdoc} - */ public function defines(string $id, string $domain = 'messages'): bool { return isset($this->messages[$domain][$id]) || isset($this->messages[$domain.self::INTL_DOMAIN_SUFFIX][$id]); } - /** - * {@inheritdoc} - */ public function get(string $id, string $domain = 'messages'): string { if (isset($this->messages[$domain.self::INTL_DOMAIN_SUFFIX][$id])) { @@ -141,7 +124,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf } /** - * {@inheritdoc} + * @return void */ public function replace(array $messages, string $domain = 'messages') { @@ -151,28 +134,23 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf } /** - * {@inheritdoc} + * @return void */ public function add(array $messages, string $domain = 'messages') { - if (!isset($this->messages[$domain])) { - $this->messages[$domain] = []; - } - $intlDomain = $domain; - if (!str_ends_with($domain, self::INTL_DOMAIN_SUFFIX)) { - $intlDomain .= self::INTL_DOMAIN_SUFFIX; - } + $altDomain = str_ends_with($domain, self::INTL_DOMAIN_SUFFIX) ? substr($domain, 0, -\strlen(self::INTL_DOMAIN_SUFFIX)) : $domain.self::INTL_DOMAIN_SUFFIX; foreach ($messages as $id => $message) { - if (isset($this->messages[$intlDomain]) && \array_key_exists($id, $this->messages[$intlDomain])) { - $this->messages[$intlDomain][$id] = $message; - } else { - $this->messages[$domain][$id] = $message; - } + unset($this->messages[$altDomain][$id]); + $this->messages[$domain][$id] = $message; + } + + if ([] === ($this->messages[$altDomain] ?? null)) { + unset($this->messages[$altDomain]); } } /** - * {@inheritdoc} + * @return void */ public function addCatalogue(MessageCatalogueInterface $catalogue) { @@ -196,10 +174,15 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf $metadata = $catalogue->getMetadata('', ''); $this->addMetadata($metadata); } + + if ($catalogue instanceof CatalogueMetadataAwareInterface) { + $catalogueMetadata = $catalogue->getCatalogueMetadata('', ''); + $this->addCatalogueMetadata($catalogueMetadata); + } } /** - * {@inheritdoc} + * @return void */ public function addFallbackCatalogue(MessageCatalogueInterface $catalogue) { @@ -230,33 +213,24 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf } } - /** - * {@inheritdoc} - */ public function getFallbackCatalogue(): ?MessageCatalogueInterface { return $this->fallbackCatalogue; } - /** - * {@inheritdoc} - */ public function getResources(): array { return array_values($this->resources); } /** - * {@inheritdoc} + * @return void */ public function addResource(ResourceInterface $resource) { $this->resources[$resource->__toString()] = $resource; } - /** - * {@inheritdoc} - */ public function getMetadata(string $key = '', string $domain = 'messages'): mixed { if ('' == $domain) { @@ -277,7 +251,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf } /** - * {@inheritdoc} + * @return void */ public function setMetadata(string $key, mixed $value, string $domain = 'messages') { @@ -285,7 +259,7 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf } /** - * {@inheritdoc} + * @return void */ public function deleteMetadata(string $key = '', string $domain = 'messages') { @@ -298,12 +272,53 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf } } + public function getCatalogueMetadata(string $key = '', string $domain = 'messages'): mixed + { + if (!$domain) { + return $this->catalogueMetadata; + } + + if (isset($this->catalogueMetadata[$domain])) { + if (!$key) { + return $this->catalogueMetadata[$domain]; + } + + if (isset($this->catalogueMetadata[$domain][$key])) { + return $this->catalogueMetadata[$domain][$key]; + } + } + + return null; + } + + /** + * @return void + */ + public function setCatalogueMetadata(string $key, mixed $value, string $domain = 'messages') + { + $this->catalogueMetadata[$domain][$key] = $value; + } + + /** + * @return void + */ + public function deleteCatalogueMetadata(string $key = '', string $domain = 'messages') + { + if (!$domain) { + $this->catalogueMetadata = []; + } elseif (!$key) { + unset($this->catalogueMetadata[$domain]); + } else { + unset($this->catalogueMetadata[$domain][$key]); + } + } + /** * Adds current values with the new values. * * @param array $values Values to add */ - private function addMetadata(array $values) + private function addMetadata(array $values): void { foreach ($values as $domain => $keys) { foreach ($keys as $key => $value) { @@ -311,4 +326,13 @@ class MessageCatalogue implements MessageCatalogueInterface, MetadataAwareInterf } } } + + private function addCatalogueMetadata(array $values): void + { + foreach ($values as $domain => $keys) { + foreach ($keys as $key => $value) { + $this->setCatalogueMetadata($key, $value, $domain); + } + } + } } diff --git a/data/web/inc/lib/vendor/symfony/translation/MessageCatalogueInterface.php b/data/web/inc/lib/vendor/symfony/translation/MessageCatalogueInterface.php index 75e3a2fa7..fd0d26d7e 100644 --- a/data/web/inc/lib/vendor/symfony/translation/MessageCatalogueInterface.php +++ b/data/web/inc/lib/vendor/symfony/translation/MessageCatalogueInterface.php @@ -36,10 +36,8 @@ interface MessageCatalogueInterface * Gets the messages within a given domain. * * If $domain is null, it returns all messages. - * - * @param string $domain The domain name */ - public function all(string $domain = null): array; + public function all(?string $domain = null): array; /** * Sets a message translation. @@ -47,6 +45,8 @@ interface MessageCatalogueInterface * @param string $id The message id * @param string $translation The messages translation * @param string $domain The domain name + * + * @return void */ public function set(string $id, string $translation, string $domain = 'messages'); @@ -79,6 +79,8 @@ interface MessageCatalogueInterface * * @param array $messages An array of translations * @param string $domain The domain name + * + * @return void */ public function replace(array $messages, string $domain = 'messages'); @@ -87,6 +89,8 @@ interface MessageCatalogueInterface * * @param array $messages An array of translations * @param string $domain The domain name + * + * @return void */ public function add(array $messages, string $domain = 'messages'); @@ -94,6 +98,8 @@ interface MessageCatalogueInterface * Merges translations from the given Catalogue into the current one. * * The two catalogues must have the same locale. + * + * @return void */ public function addCatalogue(self $catalogue); @@ -102,6 +108,8 @@ interface MessageCatalogueInterface * only when the translation does not exist. * * This is used to provide default translations when they do not exist for the current locale. + * + * @return void */ public function addFallbackCatalogue(self $catalogue); @@ -119,6 +127,8 @@ interface MessageCatalogueInterface /** * Adds a resource for this collection. + * + * @return void */ public function addResource(ResourceInterface $resource); } diff --git a/data/web/inc/lib/vendor/symfony/translation/MetadataAwareInterface.php b/data/web/inc/lib/vendor/symfony/translation/MetadataAwareInterface.php index 2eaaceb36..39e5326c3 100644 --- a/data/web/inc/lib/vendor/symfony/translation/MetadataAwareInterface.php +++ b/data/web/inc/lib/vendor/symfony/translation/MetadataAwareInterface.php @@ -12,7 +12,7 @@ namespace Symfony\Component\Translation; /** - * MetadataAwareInterface. + * This interface is used to get, set, and delete metadata about the translation messages. * * @author Fabien Potencier */ @@ -31,6 +31,8 @@ interface MetadataAwareInterface /** * Adds metadata to a message domain. + * + * @return void */ public function setMetadata(string $key, mixed $value, string $domain = 'messages'); @@ -39,6 +41,8 @@ interface MetadataAwareInterface * * Passing an empty domain will delete all metadata. Passing an empty key will * delete all metadata for the given domain. + * + * @return void */ public function deleteMetadata(string $key = '', string $domain = 'messages'); } diff --git a/data/web/inc/lib/vendor/symfony/translation/Provider/AbstractProviderFactory.php b/data/web/inc/lib/vendor/symfony/translation/Provider/AbstractProviderFactory.php index 17442fde8..f0c11d85d 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Provider/AbstractProviderFactory.php +++ b/data/web/inc/lib/vendor/symfony/translation/Provider/AbstractProviderFactory.php @@ -27,19 +27,11 @@ abstract class AbstractProviderFactory implements ProviderFactoryInterface protected function getUser(Dsn $dsn): string { - if (null === $user = $dsn->getUser()) { - throw new IncompleteDsnException('User is not set.', $dsn->getOriginalDsn()); - } - - return $user; + return $dsn->getUser() ?? throw new IncompleteDsnException('User is not set.', $dsn->getScheme().'://'.$dsn->getHost()); } protected function getPassword(Dsn $dsn): string { - if (null === $password = $dsn->getPassword()) { - throw new IncompleteDsnException('Password is not set.', $dsn->getOriginalDsn()); - } - - return $password; + return $dsn->getPassword() ?? throw new IncompleteDsnException('Password is not set.', $dsn->getOriginalDsn()); } } diff --git a/data/web/inc/lib/vendor/symfony/translation/Provider/Dsn.php b/data/web/inc/lib/vendor/symfony/translation/Provider/Dsn.php index 0f74d17fb..1d90e27f9 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Provider/Dsn.php +++ b/data/web/inc/lib/vendor/symfony/translation/Provider/Dsn.php @@ -29,29 +29,29 @@ final class Dsn private array $options = []; private string $originalDsn; - public function __construct(string $dsn) + public function __construct(#[\SensitiveParameter] string $dsn) { $this->originalDsn = $dsn; - if (false === $parsedDsn = parse_url($dsn)) { - throw new InvalidArgumentException(sprintf('The "%s" translation provider DSN is invalid.', $dsn)); + if (false === $params = parse_url($dsn)) { + throw new InvalidArgumentException('The translation provider DSN is invalid.'); } - if (!isset($parsedDsn['scheme'])) { - throw new InvalidArgumentException(sprintf('The "%s" translation provider DSN must contain a scheme.', $dsn)); + if (!isset($params['scheme'])) { + throw new InvalidArgumentException('The translation provider DSN must contain a scheme.'); } - $this->scheme = $parsedDsn['scheme']; + $this->scheme = $params['scheme']; - if (!isset($parsedDsn['host'])) { - throw new InvalidArgumentException(sprintf('The "%s" translation provider DSN must contain a host (use "default" by default).', $dsn)); + if (!isset($params['host'])) { + throw new InvalidArgumentException('The translation provider DSN must contain a host (use "default" by default).'); } - $this->host = $parsedDsn['host']; + $this->host = $params['host']; - $this->user = '' !== ($parsedDsn['user'] ?? '') ? urldecode($parsedDsn['user']) : null; - $this->password = '' !== ($parsedDsn['pass'] ?? '') ? urldecode($parsedDsn['pass']) : null; - $this->port = $parsedDsn['port'] ?? null; - $this->path = $parsedDsn['path'] ?? null; - parse_str($parsedDsn['query'] ?? '', $this->options); + $this->user = '' !== ($params['user'] ?? '') ? rawurldecode($params['user']) : null; + $this->password = '' !== ($params['pass'] ?? '') ? rawurldecode($params['pass']) : null; + $this->port = $params['port'] ?? null; + $this->path = $params['path'] ?? null; + parse_str($params['query'] ?? '', $this->options); } public function getScheme(): string @@ -74,17 +74,17 @@ final class Dsn return $this->password; } - public function getPort(int $default = null): ?int + public function getPort(?int $default = null): ?int { return $this->port ?? $default; } - public function getOption(string $key, mixed $default = null) + public function getOption(string $key, mixed $default = null): mixed { return $this->options[$key] ?? $default; } - public function getRequiredOption(string $key) + public function getRequiredOption(string $key): mixed { if (!\array_key_exists($key, $this->options) || '' === trim($this->options[$key])) { throw new MissingRequiredOptionException($key); diff --git a/data/web/inc/lib/vendor/symfony/translation/Provider/FilteringProvider.php b/data/web/inc/lib/vendor/symfony/translation/Provider/FilteringProvider.php index a43fedc71..d4465b9fd 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Provider/FilteringProvider.php +++ b/data/web/inc/lib/vendor/symfony/translation/Provider/FilteringProvider.php @@ -21,7 +21,7 @@ use Symfony\Component\Translation\TranslatorBagInterface; */ class FilteringProvider implements ProviderInterface { - private $provider; + private ProviderInterface $provider; private array $locales; private array $domains; @@ -37,9 +37,6 @@ class FilteringProvider implements ProviderInterface return (string) $this->provider; } - /** - * {@inheritdoc} - */ public function write(TranslatorBagInterface $translatorBag): void { $this->provider->write($translatorBag); diff --git a/data/web/inc/lib/vendor/symfony/translation/Provider/ProviderInterface.php b/data/web/inc/lib/vendor/symfony/translation/Provider/ProviderInterface.php index a32193f29..0e47083b6 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Provider/ProviderInterface.php +++ b/data/web/inc/lib/vendor/symfony/translation/Provider/ProviderInterface.php @@ -14,10 +14,8 @@ namespace Symfony\Component\Translation\Provider; use Symfony\Component\Translation\TranslatorBag; use Symfony\Component\Translation\TranslatorBagInterface; -interface ProviderInterface +interface ProviderInterface extends \Stringable { - public function __toString(): string; - /** * Translations available in the TranslatorBag only must be created. * Translations available in both the TranslatorBag and on the provider diff --git a/data/web/inc/lib/vendor/symfony/translation/Provider/TranslationProviderCollection.php b/data/web/inc/lib/vendor/symfony/translation/Provider/TranslationProviderCollection.php index 61ac641cd..b917415ba 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Provider/TranslationProviderCollection.php +++ b/data/web/inc/lib/vendor/symfony/translation/Provider/TranslationProviderCollection.php @@ -21,7 +21,7 @@ final class TranslationProviderCollection /** * @var array */ - private $providers; + private array $providers; /** * @param array $providers diff --git a/data/web/inc/lib/vendor/symfony/translation/PseudoLocalizationTranslator.php b/data/web/inc/lib/vendor/symfony/translation/PseudoLocalizationTranslator.php index 1d10e0ccb..f26909f5e 100644 --- a/data/web/inc/lib/vendor/symfony/translation/PseudoLocalizationTranslator.php +++ b/data/web/inc/lib/vendor/symfony/translation/PseudoLocalizationTranslator.php @@ -20,7 +20,7 @@ final class PseudoLocalizationTranslator implements TranslatorInterface { private const EXPANSION_CHARACTER = '~'; - private $translator; + private TranslatorInterface $translator; private bool $accents; private float $expansionFactor; private bool $brackets; @@ -83,10 +83,7 @@ final class PseudoLocalizationTranslator implements TranslatorInterface $this->localizableHTMLAttributes = $options['localizable_html_attributes'] ?? []; } - /** - * {@inheritdoc} - */ - public function trans(string $id, array $parameters = [], string $domain = null, string $locale = null): string + public function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null): string { $trans = ''; $visibleText = ''; @@ -123,7 +120,7 @@ final class PseudoLocalizationTranslator implements TranslatorInterface return [[true, true, $originalTrans]]; } - $html = mb_convert_encoding($originalTrans, 'HTML-ENTITIES', mb_detect_encoding($originalTrans, null, true) ?: 'UTF-8'); + $html = mb_encode_numericentity($originalTrans, [0x80, 0x10FFFF, 0, 0x1FFFFF], mb_detect_encoding($originalTrans, null, true) ?: 'UTF-8'); $useInternalErrors = libxml_use_internal_errors(true); @@ -283,7 +280,7 @@ final class PseudoLocalizationTranslator implements TranslatorInterface } $visibleLength = $this->strlen($visibleText); - $missingLength = (int) (ceil($visibleLength * $this->expansionFactor)) - $visibleLength; + $missingLength = (int) ceil($visibleLength * $this->expansionFactor) - $visibleLength; if ($this->brackets) { $missingLength -= 2; } diff --git a/data/web/inc/lib/vendor/symfony/translation/README.md b/data/web/inc/lib/vendor/symfony/translation/README.md index adda9a5b2..32e4017b7 100644 --- a/data/web/inc/lib/vendor/symfony/translation/README.md +++ b/data/web/inc/lib/vendor/symfony/translation/README.md @@ -26,12 +26,7 @@ echo $translator->trans('Hello World!'); // outputs « Bonjour ! » Sponsor ------- -The Translation component for Symfony 5.4/6.0 is [backed][1] by: - - * [Crowdin][2], a cloud-based localization management software helping teams to go global and stay agile. - * [Lokalise][3], a continuous localization and translation management platform that integrates into your development workflow so you can ship localized products, faster. - -Help Symfony by [sponsoring][4] its development! +Help Symfony by [sponsoring][1] its development! Resources --------- @@ -42,7 +37,4 @@ Resources [send Pull Requests](https://github.com/symfony/symfony/pulls) in the [main Symfony repository](https://github.com/symfony/symfony) -[1]: https://symfony.com/backers -[2]: https://crowdin.com -[3]: https://lokalise.com -[4]: https://symfony.com/sponsor +[1]: https://symfony.com/sponsor diff --git a/data/web/inc/lib/vendor/symfony/translation/Reader/TranslationReader.php b/data/web/inc/lib/vendor/symfony/translation/Reader/TranslationReader.php index bbc687e13..01408d4dc 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Reader/TranslationReader.php +++ b/data/web/inc/lib/vendor/symfony/translation/Reader/TranslationReader.php @@ -33,6 +33,8 @@ class TranslationReader implements TranslationReaderInterface * Adds a loader to the translation extractor. * * @param string $format The format of the loader + * + * @return void */ public function addLoader(string $format, LoaderInterface $loader) { @@ -40,7 +42,7 @@ class TranslationReader implements TranslationReaderInterface } /** - * {@inheritdoc} + * @return void */ public function read(string $directory, MessageCatalogue $catalogue) { diff --git a/data/web/inc/lib/vendor/symfony/translation/Reader/TranslationReaderInterface.php b/data/web/inc/lib/vendor/symfony/translation/Reader/TranslationReaderInterface.php index bc37204f9..ea74dc23f 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Reader/TranslationReaderInterface.php +++ b/data/web/inc/lib/vendor/symfony/translation/Reader/TranslationReaderInterface.php @@ -22,6 +22,8 @@ interface TranslationReaderInterface { /** * Reads translation messages from a directory to the catalogue. + * + * @return void */ public function read(string $directory, MessageCatalogue $catalogue); } diff --git a/data/web/inc/lib/vendor/symfony/translation/Resources/bin/translation-status.php b/data/web/inc/lib/vendor/symfony/translation/Resources/bin/translation-status.php index a76916427..8064190d8 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Resources/bin/translation-status.php +++ b/data/web/inc/lib/vendor/symfony/translation/Resources/bin/translation-status.php @@ -9,6 +9,10 @@ * file that was distributed with this source code. */ +if ('cli' !== \PHP_SAPI) { + throw new Exception('This script must be run from the command line.'); +} + $usageInstructions = << count($translation['missingKeys']), array_values($translationStatus))); + $totalTranslationMismatches += array_sum(array_map(fn ($translation) => count($translation['mismatches']), array_values($translationStatus))); printTranslationStatus($originalFilePath, $translationStatus, $config['verbose_output'], $config['include_completed_languages']); } exit($totalTranslationMismatches > 0 ? 1 : 0); -function findTranslationFiles($originalFilePath, $localeToAnalyze) +function findTranslationFiles($originalFilePath, $localeToAnalyze): array { $translations = []; @@ -118,7 +118,7 @@ function findTranslationFiles($originalFilePath, $localeToAnalyze) return $translations; } -function calculateTranslationStatus($originalFilePath, $translationFilePaths) +function calculateTranslationStatus($originalFilePath, $translationFilePaths): array { $translationStatus = []; $allTranslationKeys = extractTranslationKeys($originalFilePath); @@ -159,7 +159,7 @@ function extractLocaleFromFilePath($filePath) return $parts[count($parts) - 2]; } -function extractTranslationKeys($filePath) +function extractTranslationKeys($filePath): array { $translationKeys = []; $contents = new \SimpleXMLElement(file_get_contents($filePath)); diff --git a/data/web/inc/lib/vendor/symfony/translation/Resources/data/parents.json b/data/web/inc/lib/vendor/symfony/translation/Resources/data/parents.json index 288f16300..24d4d119e 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Resources/data/parents.json +++ b/data/web/inc/lib/vendor/symfony/translation/Resources/data/parents.json @@ -35,6 +35,7 @@ "en_GM": "en_001", "en_GY": "en_001", "en_HK": "en_001", + "en_ID": "en_001", "en_IE": "en_001", "en_IL": "en_001", "en_IM": "en_001", @@ -54,6 +55,7 @@ "en_MS": "en_001", "en_MT": "en_001", "en_MU": "en_001", + "en_MV": "en_001", "en_MW": "en_001", "en_MY": "en_001", "en_NA": "en_001", @@ -116,6 +118,8 @@ "es_UY": "es_419", "es_VE": "es_419", "ff_Adlm": "root", + "hi_Latn": "en_IN", + "ks_Deva": "root", "nb": "no", "nn": "no", "pa_Arab": "root", diff --git a/data/web/inc/lib/vendor/symfony/translation/Resources/functions.php b/data/web/inc/lib/vendor/symfony/translation/Resources/functions.php index 901d2f87e..0d2a037a2 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Resources/functions.php +++ b/data/web/inc/lib/vendor/symfony/translation/Resources/functions.php @@ -15,7 +15,7 @@ if (!\function_exists(t::class)) { /** * @author Nate Wiebe */ - function t(string $message, array $parameters = [], string $domain = null): TranslatableMessage + function t(string $message, array $parameters = [], ?string $domain = null): TranslatableMessage { return new TranslatableMessage($message, $parameters, $domain); } diff --git a/data/web/inc/lib/vendor/symfony/translation/Resources/schemas/xliff-core-1.2-strict.xsd b/data/web/inc/lib/vendor/symfony/translation/Resources/schemas/xliff-core-1.2-transitional.xsd similarity index 96% rename from data/web/inc/lib/vendor/symfony/translation/Resources/schemas/xliff-core-1.2-strict.xsd rename to data/web/inc/lib/vendor/symfony/translation/Resources/schemas/xliff-core-1.2-transitional.xsd index dface628c..1f38de72f 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Resources/schemas/xliff-core-1.2-strict.xsd +++ b/data/web/inc/lib/vendor/symfony/translation/Resources/schemas/xliff-core-1.2-transitional.xsd @@ -1,5 +1,4 @@ - - + - + @@ -1672,14 +1672,16 @@ Jan-10-2006 + + - + @@ -1739,10 +1741,11 @@ Jan-10-2006 + - + @@ -1791,6 +1794,7 @@ Jan-10-2006 + @@ -1838,16 +1842,34 @@ Jan-10-2006 + + + + + + + + + + + + + + + + + + - + - + @@ -1865,8 +1887,9 @@ Jan-10-2006 + - + @@ -1877,6 +1900,7 @@ Jan-10-2006 + @@ -1901,7 +1925,7 @@ Jan-10-2006 - + @@ -1913,10 +1937,11 @@ Jan-10-2006 + - + @@ -1924,6 +1949,7 @@ Jan-10-2006 + @@ -1947,7 +1973,7 @@ Jan-10-2006 - + @@ -1962,7 +1988,8 @@ Jan-10-2006 - + + @@ -1985,7 +2012,8 @@ Jan-10-2006 - + + @@ -2011,6 +2039,8 @@ Jan-10-2006 + + @@ -2018,7 +2048,7 @@ Jan-10-2006 - + @@ -2042,18 +2072,21 @@ Jan-10-2006 - + + - + + + @@ -2070,7 +2103,7 @@ Jan-10-2006 - + @@ -2089,20 +2122,22 @@ Jan-10-2006 + - + + - + @@ -2111,7 +2146,8 @@ Jan-10-2006 - + + @@ -2121,12 +2157,13 @@ Jan-10-2006 + - + @@ -2217,7 +2254,8 @@ Jan-10-2006 - + + diff --git a/data/web/inc/lib/vendor/symfony/translation/Test/ProviderFactoryTestCase.php b/data/web/inc/lib/vendor/symfony/translation/Test/ProviderFactoryTestCase.php index d6510e0dd..95ffcb1e5 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Test/ProviderFactoryTestCase.php +++ b/data/web/inc/lib/vendor/symfony/translation/Test/ProviderFactoryTestCase.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Translation\Test; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Symfony\Component\HttpClient\MockHttpClient; @@ -20,39 +21,39 @@ use Symfony\Component\Translation\Exception\UnsupportedSchemeException; use Symfony\Component\Translation\Loader\LoaderInterface; use Symfony\Component\Translation\Provider\Dsn; use Symfony\Component\Translation\Provider\ProviderFactoryInterface; +use Symfony\Component\Translation\TranslatorBagInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; /** * A test case to ease testing a translation provider factory. * * @author Mathieu Santostefano - * - * @internal */ abstract class ProviderFactoryTestCase extends TestCase { - protected $client; - protected $logger; + protected HttpClientInterface $client; + protected LoggerInterface|MockObject $logger; protected string $defaultLocale; - protected $loader; - protected $xliffFileDumper; + protected LoaderInterface|MockObject $loader; + protected XliffFileDumper|MockObject $xliffFileDumper; + protected TranslatorBagInterface|MockObject $translatorBag; abstract public function createFactory(): ProviderFactoryInterface; /** * @return iterable */ - abstract public function supportsProvider(): iterable; + abstract public static function supportsProvider(): iterable; /** - * @return iterable + * @return iterable */ - abstract public function createProvider(): iterable; + abstract public static function createProvider(): iterable; /** * @return iterable */ - public function unsupportedSchemeProvider(): iterable + public static function unsupportedSchemeProvider(): iterable { return []; } @@ -60,7 +61,7 @@ abstract class ProviderFactoryTestCase extends TestCase /** * @return iterable */ - public function incompleteDsnProvider(): iterable + public static function incompleteDsnProvider(): iterable { return []; } @@ -89,7 +90,7 @@ abstract class ProviderFactoryTestCase extends TestCase /** * @dataProvider unsupportedSchemeProvider */ - public function testUnsupportedSchemeException(string $dsn, string $message = null) + public function testUnsupportedSchemeException(string $dsn, ?string $message = null) { $factory = $this->createFactory(); @@ -106,7 +107,7 @@ abstract class ProviderFactoryTestCase extends TestCase /** * @dataProvider incompleteDsnProvider */ - public function testIncompleteDsnException(string $dsn, string $message = null) + public function testIncompleteDsnException(string $dsn, ?string $message = null) { $factory = $this->createFactory(); @@ -144,4 +145,9 @@ abstract class ProviderFactoryTestCase extends TestCase { return $this->xliffFileDumper ??= $this->createMock(XliffFileDumper::class); } + + protected function getTranslatorBag(): TranslatorBagInterface + { + return $this->translatorBag ??= $this->createMock(TranslatorBagInterface::class); + } } diff --git a/data/web/inc/lib/vendor/symfony/translation/Test/ProviderTestCase.php b/data/web/inc/lib/vendor/symfony/translation/Test/ProviderTestCase.php index 5ae26829b..a8fa0b8bb 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Test/ProviderTestCase.php +++ b/data/web/inc/lib/vendor/symfony/translation/Test/ProviderTestCase.php @@ -11,35 +11,36 @@ namespace Symfony\Component\Translation\Test; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Symfony\Component\HttpClient\MockHttpClient; use Symfony\Component\Translation\Dumper\XliffFileDumper; use Symfony\Component\Translation\Loader\LoaderInterface; use Symfony\Component\Translation\Provider\ProviderInterface; +use Symfony\Component\Translation\TranslatorBagInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; /** * A test case to ease testing a translation provider. * * @author Mathieu Santostefano - * - * @internal */ abstract class ProviderTestCase extends TestCase { - protected $client; - protected $logger; + protected HttpClientInterface $client; + protected LoggerInterface|MockObject $logger; protected string $defaultLocale; - protected $loader; - protected $xliffFileDumper; + protected LoaderInterface|MockObject $loader; + protected XliffFileDumper|MockObject $xliffFileDumper; + protected TranslatorBagInterface|MockObject $translatorBag; - abstract public function createProvider(HttpClientInterface $client, LoaderInterface $loader, LoggerInterface $logger, string $defaultLocale, string $endpoint): ProviderInterface; + abstract public static function createProvider(HttpClientInterface $client, LoaderInterface $loader, LoggerInterface $logger, string $defaultLocale, string $endpoint): ProviderInterface; /** - * @return iterable + * @return iterable */ - abstract public function toStringProvider(): iterable; + abstract public static function toStringProvider(): iterable; /** * @dataProvider toStringProvider @@ -73,4 +74,9 @@ abstract class ProviderTestCase extends TestCase { return $this->xliffFileDumper ??= $this->createMock(XliffFileDumper::class); } + + protected function getTranslatorBag(): TranslatorBagInterface + { + return $this->translatorBag ??= $this->createMock(TranslatorBagInterface::class); + } } diff --git a/data/web/inc/lib/vendor/symfony/translation/TranslatableMessage.php b/data/web/inc/lib/vendor/symfony/translation/TranslatableMessage.php index b1a3b6b13..c591e68c2 100644 --- a/data/web/inc/lib/vendor/symfony/translation/TranslatableMessage.php +++ b/data/web/inc/lib/vendor/symfony/translation/TranslatableMessage.php @@ -23,7 +23,7 @@ class TranslatableMessage implements TranslatableInterface private array $parameters; private ?string $domain; - public function __construct(string $message, array $parameters = [], string $domain = null) + public function __construct(string $message, array $parameters = [], ?string $domain = null) { $this->message = $message; $this->parameters = $parameters; @@ -50,12 +50,10 @@ class TranslatableMessage implements TranslatableInterface return $this->domain; } - public function trans(TranslatorInterface $translator, string $locale = null): string + public function trans(TranslatorInterface $translator, ?string $locale = null): string { return $translator->trans($this->getMessage(), array_map( - static function ($parameter) use ($translator, $locale) { - return $parameter instanceof TranslatableInterface ? $parameter->trans($translator, $locale) : $parameter; - }, + static fn ($parameter) => $parameter instanceof TranslatableInterface ? $parameter->trans($translator, $locale) : $parameter, $this->getParameters() ), $this->getDomain(), $locale); } diff --git a/data/web/inc/lib/vendor/symfony/translation/Translator.php b/data/web/inc/lib/vendor/symfony/translation/Translator.php index 05e84d0cc..1973d079f 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Translator.php +++ b/data/web/inc/lib/vendor/symfony/translation/Translator.php @@ -22,6 +22,7 @@ use Symfony\Component\Translation\Formatter\MessageFormatter; use Symfony\Component\Translation\Formatter\MessageFormatterInterface; use Symfony\Component\Translation\Loader\LoaderInterface; use Symfony\Contracts\Translation\LocaleAwareInterface; +use Symfony\Contracts\Translation\TranslatableInterface; use Symfony\Contracts\Translation\TranslatorInterface; // Help opcache.preload discover always-needed symbols @@ -51,7 +52,7 @@ class Translator implements TranslatorInterface, TranslatorBagInterface, LocaleA private array $resources = []; - private $formatter; + private MessageFormatterInterface $formatter; private ?string $cacheDir; @@ -59,7 +60,7 @@ class Translator implements TranslatorInterface, TranslatorBagInterface, LocaleA private array $cacheVary; - private $configCacheFactory; + private ?ConfigCacheFactoryInterface $configCacheFactory; private array $parentLocales; @@ -68,21 +69,20 @@ class Translator implements TranslatorInterface, TranslatorBagInterface, LocaleA /** * @throws InvalidArgumentException If a locale contains invalid characters */ - public function __construct(string $locale, MessageFormatterInterface $formatter = null, string $cacheDir = null, bool $debug = false, array $cacheVary = []) + public function __construct(string $locale, ?MessageFormatterInterface $formatter = null, ?string $cacheDir = null, bool $debug = false, array $cacheVary = []) { $this->setLocale($locale); - if (null === $formatter) { - $formatter = new MessageFormatter(); - } - - $this->formatter = $formatter; + $this->formatter = $formatter ??= new MessageFormatter(); $this->cacheDir = $cacheDir; $this->debug = $debug; $this->cacheVary = $cacheVary; $this->hasIntlFormatter = $formatter instanceof IntlFormatterInterface; } + /** + * @return void + */ public function setConfigCacheFactory(ConfigCacheFactoryInterface $configCacheFactory) { $this->configCacheFactory = $configCacheFactory; @@ -92,6 +92,8 @@ class Translator implements TranslatorInterface, TranslatorBagInterface, LocaleA * Adds a Loader. * * @param string $format The name of the loader (@see addResource()) + * + * @return void */ public function addLoader(string $format, LoaderInterface $loader) { @@ -104,13 +106,13 @@ class Translator implements TranslatorInterface, TranslatorBagInterface, LocaleA * @param string $format The name of the loader (@see addLoader()) * @param mixed $resource The resource name * + * @return void + * * @throws InvalidArgumentException If the locale contains invalid characters */ - public function addResource(string $format, mixed $resource, string $locale, string $domain = null) + public function addResource(string $format, mixed $resource, string $locale, ?string $domain = null) { - if (null === $domain) { - $domain = 'messages'; - } + $domain ??= 'messages'; $this->assertValidLocale($locale); $locale ?: $locale = class_exists(\Locale::class) ? \Locale::getDefault() : 'en'; @@ -125,7 +127,7 @@ class Translator implements TranslatorInterface, TranslatorBagInterface, LocaleA } /** - * {@inheritdoc} + * @return void */ public function setLocale(string $locale) { @@ -133,9 +135,6 @@ class Translator implements TranslatorInterface, TranslatorBagInterface, LocaleA $this->locale = $locale; } - /** - * {@inheritdoc} - */ public function getLocale(): string { return $this->locale ?: (class_exists(\Locale::class) ? \Locale::getDefault() : 'en'); @@ -146,6 +145,8 @@ class Translator implements TranslatorInterface, TranslatorBagInterface, LocaleA * * @param string[] $locales * + * @return void + * * @throws InvalidArgumentException If a locale contains invalid characters */ public function setFallbackLocales(array $locales) @@ -170,18 +171,13 @@ class Translator implements TranslatorInterface, TranslatorBagInterface, LocaleA return $this->fallbackLocales; } - /** - * {@inheritdoc} - */ - public function trans(?string $id, array $parameters = [], string $domain = null, string $locale = null): string + public function trans(?string $id, array $parameters = [], ?string $domain = null, ?string $locale = null): string { if (null === $id || '' === $id) { return ''; } - if (null === $domain) { - $domain = 'messages'; - } + $domain ??= 'messages'; $catalogue = $this->getCatalogue($locale); $locale = $catalogue->getLocale(); @@ -194,6 +190,8 @@ class Translator implements TranslatorInterface, TranslatorBagInterface, LocaleA } } + $parameters = array_map(fn ($parameter) => $parameter instanceof TranslatableInterface ? $parameter->trans($this, $locale) : $parameter, $parameters); + $len = \strlen(MessageCatalogue::INTL_DOMAIN_SUFFIX); if ($this->hasIntlFormatter && ($catalogue->defines($id, $domain.MessageCatalogue::INTL_DOMAIN_SUFFIX) @@ -205,10 +203,7 @@ class Translator implements TranslatorInterface, TranslatorBagInterface, LocaleA return $this->formatter->format($catalogue->get($id, $domain), $locale, $parameters); } - /** - * {@inheritdoc} - */ - public function getCatalogue(string $locale = null): MessageCatalogueInterface + public function getCatalogue(?string $locale = null): MessageCatalogueInterface { if (!$locale) { $locale = $this->getLocale(); @@ -223,9 +218,6 @@ class Translator implements TranslatorInterface, TranslatorBagInterface, LocaleA return $this->catalogues[$locale]; } - /** - * {@inheritdoc} - */ public function getCatalogues(): array { return array_values($this->catalogues); @@ -241,6 +233,9 @@ class Translator implements TranslatorInterface, TranslatorBagInterface, LocaleA return $this->loaders; } + /** + * @return void + */ protected function loadCatalogue(string $locale) { if (null === $this->cacheDir) { @@ -250,6 +245,9 @@ class Translator implements TranslatorInterface, TranslatorBagInterface, LocaleA } } + /** + * @return void + */ protected function initializeCatalogue(string $locale) { $this->assertValidLocale($locale); @@ -386,6 +384,9 @@ EOF } } + /** + * @return array + */ protected function computeFallbackLocales(string $locale) { $this->parentLocales ??= json_decode(file_get_contents(__DIR__.'/Resources/data/parents.json'), true); @@ -430,6 +431,8 @@ EOF /** * Asserts that the locale is valid, throws an Exception if not. * + * @return void + * * @throws InvalidArgumentException If the locale contains invalid characters */ protected function assertValidLocale(string $locale) diff --git a/data/web/inc/lib/vendor/symfony/translation/TranslatorBag.php b/data/web/inc/lib/vendor/symfony/translation/TranslatorBag.php index ffd109f17..3b47aecee 100644 --- a/data/web/inc/lib/vendor/symfony/translation/TranslatorBag.php +++ b/data/web/inc/lib/vendor/symfony/translation/TranslatorBag.php @@ -35,10 +35,7 @@ final class TranslatorBag implements TranslatorBagInterface } } - /** - * {@inheritdoc} - */ - public function getCatalogue(string $locale = null): MessageCatalogueInterface + public function getCatalogue(?string $locale = null): MessageCatalogueInterface { if (null === $locale || !isset($this->catalogues[$locale])) { $this->catalogues[$locale] = new MessageCatalogue($locale); @@ -47,9 +44,6 @@ final class TranslatorBag implements TranslatorBagInterface return $this->catalogues[$locale]; } - /** - * {@inheritdoc} - */ public function getCatalogues(): array { return array_values($this->catalogues); @@ -70,7 +64,7 @@ final class TranslatorBag implements TranslatorBagInterface $operation->moveMessagesToIntlDomainsIfPossible(AbstractOperation::NEW_BATCH); $newCatalogue = new MessageCatalogue($locale); - foreach ($operation->getDomains() as $domain) { + foreach ($catalogue->getDomains() as $domain) { $newCatalogue->add($operation->getNewMessages($domain), $domain); } @@ -94,7 +88,10 @@ final class TranslatorBag implements TranslatorBagInterface $obsoleteCatalogue = new MessageCatalogue($locale); foreach ($operation->getDomains() as $domain) { - $obsoleteCatalogue->add($operation->getObsoleteMessages($domain), $domain); + $obsoleteCatalogue->add( + array_diff($operation->getMessages($domain), $operation->getNewMessages($domain)), + $domain + ); } $diff->addCatalogue($obsoleteCatalogue); diff --git a/data/web/inc/lib/vendor/symfony/translation/TranslatorBagInterface.php b/data/web/inc/lib/vendor/symfony/translation/TranslatorBagInterface.php index a787acf12..365d1f13b 100644 --- a/data/web/inc/lib/vendor/symfony/translation/TranslatorBagInterface.php +++ b/data/web/inc/lib/vendor/symfony/translation/TranslatorBagInterface.php @@ -25,7 +25,7 @@ interface TranslatorBagInterface * * @throws InvalidArgumentException If the locale contains invalid characters */ - public function getCatalogue(string $locale = null): MessageCatalogueInterface; + public function getCatalogue(?string $locale = null): MessageCatalogueInterface; /** * Returns all catalogues of the instance. diff --git a/data/web/inc/lib/vendor/symfony/translation/Util/ArrayConverter.php b/data/web/inc/lib/vendor/symfony/translation/Util/ArrayConverter.php index 60b8be6e0..64e15b485 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Util/ArrayConverter.php +++ b/data/web/inc/lib/vendor/symfony/translation/Util/ArrayConverter.php @@ -36,7 +36,7 @@ class ArrayConverter $tree = []; foreach ($messages as $id => $value) { - $referenceToElement = &self::getElementByPath($tree, explode('.', $id)); + $referenceToElement = &self::getElementByPath($tree, self::getKeyParts($id)); $referenceToElement = $value; @@ -46,7 +46,7 @@ class ArrayConverter return $tree; } - private static function &getElementByPath(array &$tree, array $parts) + private static function &getElementByPath(array &$tree, array $parts): mixed { $elem = &$tree; $parentOfElem = null; @@ -63,6 +63,7 @@ class ArrayConverter $elem = &$elem[implode('.', \array_slice($parts, $i))]; break; } + $parentOfElem = &$elem; $elem = &$elem[$part]; } @@ -82,7 +83,7 @@ class ArrayConverter return $elem; } - private static function cancelExpand(array &$tree, string $prefix, array $node) + private static function cancelExpand(array &$tree, string $prefix, array $node): void { $prefix .= '.'; @@ -94,4 +95,48 @@ class ArrayConverter } } } + + /** + * @return string[] + */ + private static function getKeyParts(string $key): array + { + $parts = explode('.', $key); + $partsCount = \count($parts); + + $result = []; + $buffer = ''; + + foreach ($parts as $index => $part) { + if (0 === $index && '' === $part) { + $buffer = '.'; + + continue; + } + + if ($index === $partsCount - 1 && '' === $part) { + $buffer .= '.'; + $result[] = $buffer; + + continue; + } + + if (isset($parts[$index + 1]) && '' === $parts[$index + 1]) { + $buffer .= $part; + + continue; + } + + if ($buffer) { + $result[] = $buffer.$part; + $buffer = ''; + + continue; + } + + $result[] = $part; + } + + return $result; + } } diff --git a/data/web/inc/lib/vendor/symfony/translation/Util/XliffUtils.php b/data/web/inc/lib/vendor/symfony/translation/Util/XliffUtils.php index 85ecc8504..335c34beb 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Util/XliffUtils.php +++ b/data/web/inc/lib/vendor/symfony/translation/Util/XliffUtils.php @@ -129,7 +129,7 @@ class XliffUtils private static function getSchema(string $xliffVersion): string { if ('1.2' === $xliffVersion) { - $schemaSource = file_get_contents(__DIR__.'/../Resources/schemas/xliff-core-1.2-strict.xsd'); + $schemaSource = file_get_contents(__DIR__.'/../Resources/schemas/xliff-core-1.2-transitional.xsd'); $xmlUri = 'http://www.w3.org/2001/xml.xsd'; } elseif ('2.0' === $xliffVersion) { $schemaSource = file_get_contents(__DIR__.'/../Resources/schemas/xliff-core-2.0.xsd'); diff --git a/data/web/inc/lib/vendor/symfony/translation/Writer/TranslationWriter.php b/data/web/inc/lib/vendor/symfony/translation/Writer/TranslationWriter.php index 5dd3a5c40..61e03cb0e 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Writer/TranslationWriter.php +++ b/data/web/inc/lib/vendor/symfony/translation/Writer/TranslationWriter.php @@ -30,6 +30,8 @@ class TranslationWriter implements TranslationWriterInterface /** * Adds a dumper to the writer. + * + * @return void */ public function addDumper(string $format, DumperInterface $dumper) { @@ -50,6 +52,8 @@ class TranslationWriter implements TranslationWriterInterface * @param string $format The format to use to dump the messages * @param array $options Options that are passed to the dumper * + * @return void + * * @throws InvalidArgumentException */ public function write(MessageCatalogue $catalogue, string $format, array $options = []) diff --git a/data/web/inc/lib/vendor/symfony/translation/Writer/TranslationWriterInterface.php b/data/web/inc/lib/vendor/symfony/translation/Writer/TranslationWriterInterface.php index 43213097e..5ebb9794a 100644 --- a/data/web/inc/lib/vendor/symfony/translation/Writer/TranslationWriterInterface.php +++ b/data/web/inc/lib/vendor/symfony/translation/Writer/TranslationWriterInterface.php @@ -27,6 +27,8 @@ interface TranslationWriterInterface * @param string $format The format to use to dump the messages * @param array $options Options that are passed to the dumper * + * @return void + * * @throws InvalidArgumentException */ public function write(MessageCatalogue $catalogue, string $format, array $options = []); diff --git a/data/web/inc/lib/vendor/symfony/translation/composer.json b/data/web/inc/lib/vendor/symfony/translation/composer.json index abe8b972c..af6f7a3df 100644 --- a/data/web/inc/lib/vendor/symfony/translation/composer.json +++ b/data/web/inc/lib/vendor/symfony/translation/composer.json @@ -16,27 +16,32 @@ } ], "require": { - "php": ">=8.0.2", + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/translation-contracts": "^2.3|^3.0" + "symfony/translation-contracts": "^2.5|^3.0" }, "require-dev": { - "symfony/config": "^5.4|^6.0", - "symfony/console": "^5.4|^6.0", - "symfony/dependency-injection": "^5.4|^6.0", - "symfony/http-client-contracts": "^1.1|^2.0|^3.0", - "symfony/http-kernel": "^5.4|^6.0", - "symfony/intl": "^5.4|^6.0", + "nikic/php-parser": "^4.18|^5.0", + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/console": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/http-client-contracts": "^2.5|^3.0", + "symfony/http-kernel": "^5.4|^6.0|^7.0", + "symfony/intl": "^5.4|^6.0|^7.0", "symfony/polyfill-intl-icu": "^1.21", - "symfony/service-contracts": "^1.1.2|^2|^3", - "symfony/yaml": "^5.4|^6.0", - "symfony/finder": "^5.4|^6.0", + "symfony/routing": "^5.4|^6.0|^7.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/yaml": "^5.4|^6.0|^7.0", + "symfony/finder": "^5.4|^6.0|^7.0", "psr/log": "^1|^2|^3" }, "conflict": { "symfony/config": "<5.4", "symfony/dependency-injection": "<5.4", + "symfony/http-client-contracts": "<2.5", "symfony/http-kernel": "<5.4", + "symfony/service-contracts": "<2.5", "symfony/twig-bundle": "<5.4", "symfony/yaml": "<5.4", "symfony/console": "<5.4" @@ -44,11 +49,6 @@ "provide": { "symfony/translation-implementation": "2.3|3.0" }, - "suggest": { - "symfony/config": "", - "symfony/yaml": "", - "psr/log-implementation": "To use logging capability in translator" - }, "autoload": { "files": [ "Resources/functions.php" ], "psr-4": { "Symfony\\Component\\Translation\\": "" }, diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/CHANGELOG.md b/data/web/inc/lib/vendor/symfony/var-dumper/CHANGELOG.md index f58ed3170..7481cff1a 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/CHANGELOG.md +++ b/data/web/inc/lib/vendor/symfony/var-dumper/CHANGELOG.md @@ -1,6 +1,25 @@ CHANGELOG ========= +6.4 +--- + + * Dump uninitialized properties + +6.3 +--- + + * Add caster for `WeakMap` + * Add support of named arguments to `dd()` and `dump()` to display the argument name + * Add support for `Relay\Relay` + * Add display of invisible characters + +6.2 +--- + + * Add support for `FFI\CData` and `FFI\CType` + * Deprecate calling `VarDumper::setHandler()` without arguments + 5.4 --- diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/AmqpCaster.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/AmqpCaster.php index dc3b62198..22026f46a 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/AmqpCaster.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/AmqpCaster.php @@ -46,6 +46,9 @@ class AmqpCaster \AMQP_EX_TYPE_HEADERS => 'AMQP_EX_TYPE_HEADERS', ]; + /** + * @return array + */ public static function castConnection(\AMQPConnection $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -79,6 +82,9 @@ class AmqpCaster return $a; } + /** + * @return array + */ public static function castChannel(\AMQPChannel $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -102,6 +108,9 @@ class AmqpCaster return $a; } + /** + * @return array + */ public static function castQueue(\AMQPQueue $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -125,6 +134,9 @@ class AmqpCaster return $a; } + /** + * @return array + */ public static function castExchange(\AMQPExchange $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -153,6 +165,9 @@ class AmqpCaster return $a; } + /** + * @return array + */ public static function castEnvelope(\AMQPEnvelope $c, array $a, Stub $stub, bool $isNested, int $filter = 0) { $prefix = Caster::PREFIX_VIRTUAL; diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ArgsStub.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ArgsStub.php index a89a71b1f..9dc24c1b1 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ArgsStub.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ArgsStub.php @@ -28,7 +28,7 @@ class ArgsStub extends EnumStub $values = []; foreach ($args as $k => $v) { - $values[$k] = !is_scalar($v) && !$v instanceof Stub ? new CutStub($v) : $v; + $values[$k] = !\is_scalar($v) && !$v instanceof Stub ? new CutStub($v) : $v; } if (null === $params) { parent::__construct($values, false); @@ -57,7 +57,7 @@ class ArgsStub extends EnumStub try { $r = null !== $class ? new \ReflectionMethod($class, $function) : new \ReflectionFunction($function); - } catch (\ReflectionException $e) { + } catch (\ReflectionException) { return [null, null]; } diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/Caster.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/Caster.php index 53f4461d0..d9577e7ae 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/Caster.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/Caster.php @@ -32,22 +32,27 @@ class Caster public const EXCLUDE_EMPTY = 128; public const EXCLUDE_NOT_IMPORTANT = 256; public const EXCLUDE_STRICT = 512; + public const EXCLUDE_UNINITIALIZED = 1024; public const PREFIX_VIRTUAL = "\0~\0"; public const PREFIX_DYNAMIC = "\0+\0"; public const PREFIX_PROTECTED = "\0*\0"; + // usage: sprintf(Caster::PATTERN_PRIVATE, $class, $property) + public const PATTERN_PRIVATE = "\0%s\0%s"; + + private static array $classProperties = []; /** * Casts objects to arrays and adds the dynamic property prefix. * * @param bool $hasDebugInfo Whether the __debugInfo method exists on $obj or not */ - public static function castObject(object $obj, string $class, bool $hasDebugInfo = false, string $debugClass = null): array + public static function castObject(object $obj, string $class, bool $hasDebugInfo = false, ?string $debugClass = null): array { if ($hasDebugInfo) { try { $debugInfo = $obj->__debugInfo(); - } catch (\Exception $e) { + } catch (\Throwable) { // ignore failing __debugInfo() $hasDebugInfo = false; } @@ -59,20 +64,17 @@ class Caster return $a; } + $classProperties = self::$classProperties[$class] ??= self::getClassProperties(new \ReflectionClass($class)); + $a = array_replace($classProperties, $a); + if ($a) { - static $publicProperties = []; - $debugClass = $debugClass ?? get_debug_type($obj); + $debugClass ??= get_debug_type($obj); $i = 0; $prefixedKeys = []; foreach ($a as $k => $v) { if ("\0" !== ($k[0] ?? '')) { - if (!isset($publicProperties[$class])) { - foreach ((new \ReflectionClass($class))->getProperties(\ReflectionProperty::IS_PUBLIC) as $prop) { - $publicProperties[$class][$prop->name] = true; - } - } - if (!isset($publicProperties[$class][$k])) { + if (!isset($classProperties[$k])) { $prefixedKeys[$i] = self::PREFIX_DYNAMIC.$k; } } elseif ($debugClass !== $class && 1 === strpos($k, $class)) { @@ -115,7 +117,7 @@ class Caster * @param array $a The array containing the properties to filter * @param int $filter A bit field of Caster::EXCLUDE_* constants specifying which properties to filter out * @param string[] $listedProperties List of properties to exclude when Caster::EXCLUDE_VERBOSE is set, and to preserve when Caster::EXCLUDE_NOT_IMPORTANT is set - * @param int &$count Set to the number of removed properties + * @param int|null &$count Set to the number of removed properties */ public static function filter(array $a, int $filter, array $listedProperties = [], ?int &$count = 0): array { @@ -129,6 +131,8 @@ class Caster $type |= self::EXCLUDE_EMPTY & $filter; } elseif (false === $v || '' === $v || '0' === $v || 0 === $v || 0.0 === $v || [] === $v) { $type |= self::EXCLUDE_EMPTY & $filter; + } elseif ($v instanceof UninitializedStub) { + $type |= self::EXCLUDE_UNINITIALIZED & $filter; } if ((self::EXCLUDE_NOT_IMPORTANT & $filter) && !\in_array($k, $listedProperties, true)) { $type |= self::EXCLUDE_NOT_IMPORTANT; @@ -167,4 +171,28 @@ class Caster return $a; } + + private static function getClassProperties(\ReflectionClass $class): array + { + $classProperties = []; + $className = $class->name; + + if ($parent = $class->getParentClass()) { + $classProperties += self::$classProperties[$parent->name] ??= self::getClassProperties($parent); + } + + foreach ($class->getProperties() as $p) { + if ($p->isStatic()) { + continue; + } + + $classProperties[match (true) { + $p->isPublic() => $p->name, + $p->isProtected() => self::PREFIX_PROTECTED.$p->name, + default => "\0".$className."\0".$p->name, + }] = new UninitializedStub($p); + } + + return $classProperties; + } } diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ClassStub.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ClassStub.php index 1ac6d0ac3..914728663 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ClassStub.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ClassStub.php @@ -24,7 +24,7 @@ class ClassStub extends ConstStub * @param string $identifier A PHP identifier, e.g. a class, method, interface, etc. name * @param callable $callable The callable targeted by the identifier when it is ambiguous or not a real PHP identifier */ - public function __construct(string $identifier, callable|array|string $callable = null) + public function __construct(string $identifier, callable|array|string|null $callable = null) { $this->value = $identifier; @@ -50,15 +50,13 @@ class ClassStub extends ConstStub if (\is_array($r)) { try { $r = new \ReflectionMethod($r[0], $r[1]); - } catch (\ReflectionException $e) { + } catch (\ReflectionException) { $r = new \ReflectionClass($r[0]); } } if (str_contains($identifier, "@anonymous\0")) { - $this->value = $identifier = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function ($m) { - return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0]; - }, $identifier); + $this->value = $identifier = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', fn ($m) => class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0], $identifier); } if (null !== $callable && $r instanceof \ReflectionFunctionAbstract) { @@ -71,7 +69,7 @@ class ClassStub extends ConstStub $this->value .= $s; } } - } catch (\ReflectionException $e) { + } catch (\ReflectionException) { return; } finally { if (0 < $i = strrpos($this->value, '\\')) { @@ -87,6 +85,9 @@ class ClassStub extends ConstStub } } + /** + * @return mixed + */ public static function wrapCallable(mixed $callable) { if (\is_object($callable) || !\is_callable($callable)) { diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ConstStub.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ConstStub.php index d7d1812bd..587c6c398 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ConstStub.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ConstStub.php @@ -20,7 +20,7 @@ use Symfony\Component\VarDumper\Cloner\Stub; */ class ConstStub extends Stub { - public function __construct(string $name, string|int|float $value = null) + public function __construct(string $name, string|int|float|null $value = null) { $this->class = $name; $this->value = 1 < \func_num_args() ? $value : $name; diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/CutStub.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/CutStub.php index b5a96a02c..772399ef6 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/CutStub.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/CutStub.php @@ -27,7 +27,7 @@ class CutStub extends Stub switch (\gettype($value)) { case 'object': $this->type = self::TYPE_OBJECT; - $this->class = \get_class($value); + $this->class = $value::class; if ($value instanceof \Closure) { ReflectionCaster::castClosure($value, [], $this, true, Caster::EXCLUDE_VERBOSE); diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/DOMCaster.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/DOMCaster.php index 4dd16e0ee..d2d3fc129 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/DOMCaster.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/DOMCaster.php @@ -63,6 +63,9 @@ class DOMCaster \XML_NAMESPACE_DECL_NODE => 'XML_NAMESPACE_DECL_NODE', ]; + /** + * @return array + */ public static function castException(\DOMException $e, array $a, Stub $stub, bool $isNested) { $k = Caster::PREFIX_PROTECTED.'code'; @@ -73,6 +76,9 @@ class DOMCaster return $a; } + /** + * @return array + */ public static function castLength($dom, array $a, Stub $stub, bool $isNested) { $a += [ @@ -82,6 +88,9 @@ class DOMCaster return $a; } + /** + * @return array + */ public static function castImplementation(\DOMImplementation $dom, array $a, Stub $stub, bool $isNested) { $a += [ @@ -92,6 +101,9 @@ class DOMCaster return $a; } + /** + * @return array + */ public static function castNode(\DOMNode $dom, array $a, Stub $stub, bool $isNested) { $a += [ @@ -116,6 +128,9 @@ class DOMCaster return $a; } + /** + * @return array + */ public static function castNameSpaceNode(\DOMNameSpaceNode $dom, array $a, Stub $stub, bool $isNested) { $a += [ @@ -132,6 +147,9 @@ class DOMCaster return $a; } + /** + * @return array + */ public static function castDocument(\DOMDocument $dom, array $a, Stub $stub, bool $isNested, int $filter = 0) { $a += [ @@ -166,6 +184,9 @@ class DOMCaster return $a; } + /** + * @return array + */ public static function castCharacterData(\DOMCharacterData $dom, array $a, Stub $stub, bool $isNested) { $a += [ @@ -176,6 +197,9 @@ class DOMCaster return $a; } + /** + * @return array + */ public static function castAttr(\DOMAttr $dom, array $a, Stub $stub, bool $isNested) { $a += [ @@ -189,6 +213,9 @@ class DOMCaster return $a; } + /** + * @return array + */ public static function castElement(\DOMElement $dom, array $a, Stub $stub, bool $isNested) { $a += [ @@ -199,6 +226,9 @@ class DOMCaster return $a; } + /** + * @return array + */ public static function castText(\DOMText $dom, array $a, Stub $stub, bool $isNested) { $a += [ @@ -208,43 +238,9 @@ class DOMCaster return $a; } - public static function castTypeinfo(\DOMTypeinfo $dom, array $a, Stub $stub, bool $isNested) - { - $a += [ - 'typeName' => $dom->typeName, - 'typeNamespace' => $dom->typeNamespace, - ]; - - return $a; - } - - public static function castDomError(\DOMDomError $dom, array $a, Stub $stub, bool $isNested) - { - $a += [ - 'severity' => $dom->severity, - 'message' => $dom->message, - 'type' => $dom->type, - 'relatedException' => $dom->relatedException, - 'related_data' => $dom->related_data, - 'location' => $dom->location, - ]; - - return $a; - } - - public static function castLocator(\DOMLocator $dom, array $a, Stub $stub, bool $isNested) - { - $a += [ - 'lineNumber' => $dom->lineNumber, - 'columnNumber' => $dom->columnNumber, - 'offset' => $dom->offset, - 'relatedNode' => $dom->relatedNode, - 'uri' => $dom->uri ? new LinkStub($dom->uri, $dom->lineNumber) : $dom->uri, - ]; - - return $a; - } - + /** + * @return array + */ public static function castDocumentType(\DOMDocumentType $dom, array $a, Stub $stub, bool $isNested) { $a += [ @@ -259,6 +255,9 @@ class DOMCaster return $a; } + /** + * @return array + */ public static function castNotation(\DOMNotation $dom, array $a, Stub $stub, bool $isNested) { $a += [ @@ -269,6 +268,9 @@ class DOMCaster return $a; } + /** + * @return array + */ public static function castEntity(\DOMEntity $dom, array $a, Stub $stub, bool $isNested) { $a += [ @@ -283,6 +285,9 @@ class DOMCaster return $a; } + /** + * @return array + */ public static function castProcessingInstruction(\DOMProcessingInstruction $dom, array $a, Stub $stub, bool $isNested) { $a += [ @@ -293,6 +298,9 @@ class DOMCaster return $a; } + /** + * @return array + */ public static function castXPath(\DOMXPath $dom, array $a, Stub $stub, bool $isNested) { $a += [ diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/DateCaster.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/DateCaster.php index 99f53849b..a0cbddb76 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/DateCaster.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/DateCaster.php @@ -24,11 +24,14 @@ class DateCaster { private const PERIOD_LIMIT = 3; + /** + * @return array + */ public static function castDateTime(\DateTimeInterface $d, array $a, Stub $stub, bool $isNested, int $filter) { $prefix = Caster::PREFIX_VIRTUAL; - $location = $d->getTimezone()->getLocation(); - $fromNow = (new \DateTime())->diff($d); + $location = $d->getTimezone() ? $d->getTimezone()->getLocation() : null; + $fromNow = (new \DateTimeImmutable())->diff($d); $title = $d->format('l, F j, Y') ."\n".self::formatInterval($fromNow).' from now' @@ -47,6 +50,9 @@ class DateCaster return $a; } + /** + * @return array + */ public static function castInterval(\DateInterval $interval, array $a, Stub $stub, bool $isNested, int $filter) { $now = new \DateTimeImmutable('@0', new \DateTimeZone('UTC')); @@ -76,10 +82,13 @@ class DateCaster return $i->format(rtrim($format)); } + /** + * @return array + */ public static function castTimeZone(\DateTimeZone $timeZone, array $a, Stub $stub, bool $isNested, int $filter) { $location = $timeZone->getLocation(); - $formatted = (new \DateTime('now', $timeZone))->format($location ? 'e (P)' : 'P'); + $formatted = (new \DateTimeImmutable('now', $timeZone))->format($location ? 'e (P)' : 'P'); $title = $location && \extension_loaded('intl') ? \Locale::getDisplayRegion('-'.$location['country_code']) : ''; $z = [Caster::PREFIX_VIRTUAL.'timezone' => new ConstStub($formatted, $title)]; @@ -87,6 +96,9 @@ class DateCaster return $filter & Caster::EXCLUDE_VERBOSE ? $z : $z + $a; } + /** + * @return array + */ public static function castPeriod(\DatePeriod $p, array $a, Stub $stub, bool $isNested, int $filter) { $dates = []; @@ -103,11 +115,11 @@ class DateCaster } $period = sprintf( - 'every %s, from %s (%s) %s', + 'every %s, from %s%s %s', self::formatInterval($p->getDateInterval()), + $p->include_start_date ? '[' : ']', self::formatDateTime($p->getStartDate()), - $p->include_start_date ? 'included' : 'excluded', - ($end = $p->getEndDate()) ? 'to '.self::formatDateTime($end) : 'recurring '.$p->recurrences.' time/s' + ($end = $p->getEndDate()) ? 'to '.self::formatDateTime($end).(\PHP_VERSION_ID >= 80200 && $p->include_end_date ? ']' : '[') : 'recurring '.$p->recurrences.' time/s' ); $p = [Caster::PREFIX_VIRTUAL.'period' => new ConstStub($period, implode("\n", $dates))]; diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/DoctrineCaster.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/DoctrineCaster.php index 129b2cb47..3120c3d91 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/DoctrineCaster.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/DoctrineCaster.php @@ -25,6 +25,9 @@ use Symfony\Component\VarDumper\Cloner\Stub; */ class DoctrineCaster { + /** + * @return array + */ public static function castCommonProxy(CommonProxy $proxy, array $a, Stub $stub, bool $isNested) { foreach (['__cloner__', '__initializer__'] as $k) { @@ -37,6 +40,9 @@ class DoctrineCaster return $a; } + /** + * @return array + */ public static function castOrmProxy(OrmProxy $proxy, array $a, Stub $stub, bool $isNested) { foreach (['_entityPersister', '_identifier'] as $k) { @@ -49,6 +55,9 @@ class DoctrineCaster return $a; } + /** + * @return array + */ public static function castPersistentCollection(PersistentCollection $coll, array $a, Stub $stub, bool $isNested) { foreach (['snapshot', 'association', 'typeClass'] as $k) { diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/DsPairStub.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/DsPairStub.php index 22112af9c..afa2727b1 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/DsPairStub.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/DsPairStub.php @@ -18,7 +18,7 @@ use Symfony\Component\VarDumper\Cloner\Stub; */ class DsPairStub extends Stub { - public function __construct(string|int $key, mixed $value) + public function __construct(mixed $key, mixed $value) { $this->value = [ Caster::PREFIX_VIRTUAL.'key' => $key, diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ExceptionCaster.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ExceptionCaster.php index 8e517e079..02efb1b02 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ExceptionCaster.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ExceptionCaster.php @@ -11,6 +11,7 @@ namespace Symfony\Component\VarDumper\Caster; +use Symfony\Component\ErrorHandler\Exception\FlattenException; use Symfony\Component\ErrorHandler\Exception\SilencedErrorContext; use Symfony\Component\VarDumper\Cloner\Stub; use Symfony\Component\VarDumper\Exception\ThrowingCasterException; @@ -46,16 +47,25 @@ class ExceptionCaster private static array $framesCache = []; + /** + * @return array + */ public static function castError(\Error $e, array $a, Stub $stub, bool $isNested, int $filter = 0) { return self::filterExceptionArray($stub->class, $a, "\0Error\0", $filter); } + /** + * @return array + */ public static function castException(\Exception $e, array $a, Stub $stub, bool $isNested, int $filter = 0) { return self::filterExceptionArray($stub->class, $a, "\0Exception\0", $filter); } + /** + * @return array + */ public static function castErrorException(\ErrorException $e, array $a, Stub $stub, bool $isNested) { if (isset($a[$s = Caster::PREFIX_PROTECTED.'severity'], self::$errorTypes[$a[$s]])) { @@ -65,6 +75,9 @@ class ExceptionCaster return $a; } + /** + * @return array + */ public static function castThrowingCasterException(ThrowingCasterException $e, array $a, Stub $stub, bool $isNested) { $trace = Caster::PREFIX_VIRTUAL.'trace'; @@ -83,6 +96,9 @@ class ExceptionCaster return $a; } + /** + * @return array + */ public static function castSilencedErrorContext(SilencedErrorContext $e, array $a, Stub $stub, bool $isNested) { $sPrefix = "\0".SilencedErrorContext::class."\0"; @@ -110,6 +126,9 @@ class ExceptionCaster return $a; } + /** + * @return array + */ public static function castTraceStub(TraceStub $trace, array $a, Stub $stub, bool $isNested) { if (!$isNested) { @@ -184,6 +203,9 @@ class ExceptionCaster return $a; } + /** + * @return array + */ public static function castFrameStub(FrameStub $frame, array $a, Stub $stub, bool $isNested) { if (!$isNested) { @@ -267,6 +289,19 @@ class ExceptionCaster return $a; } + /** + * @return array + */ + public static function castFlattenException(FlattenException $e, array $a, Stub $stub, bool $isNested) + { + if ($isNested) { + $k = sprintf(Caster::PATTERN_PRIVATE, FlattenException::class, 'traceAsString'); + $a[$k] = new CutStub($a[$k]); + } + + return $a; + } + private static function filterExceptionArray(string $xClass, array $a, string $xPrefix, int $filter): array { if (isset($a[$xPrefix.'trace'])) { @@ -285,12 +320,10 @@ class ExceptionCaster if (empty($a[$xPrefix.'previous'])) { unset($a[$xPrefix.'previous']); } - unset($a[$xPrefix.'string'], $a[Caster::PREFIX_DYNAMIC.'xdebug_message'], $a[Caster::PREFIX_DYNAMIC.'__destructorException']); + unset($a[$xPrefix.'string'], $a[Caster::PREFIX_DYNAMIC.'xdebug_message']); if (isset($a[Caster::PREFIX_PROTECTED.'message']) && str_contains($a[Caster::PREFIX_PROTECTED.'message'], "@anonymous\0")) { - $a[Caster::PREFIX_PROTECTED.'message'] = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function ($m) { - return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0]; - }, $a[Caster::PREFIX_PROTECTED.'message']); + $a[Caster::PREFIX_PROTECTED.'message'] = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', fn ($m) => class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0], $a[Caster::PREFIX_PROTECTED.'message']); } if (isset($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line'])) { @@ -337,7 +370,7 @@ class ExceptionCaster $stub->attr['file'] = $f; $stub->attr['line'] = $caller->getStartLine(); } - } catch (\ReflectionException $e) { + } catch (\ReflectionException) { // ignore fake class/function } @@ -352,9 +385,7 @@ class ExceptionCaster $pad = null; for ($i = $srcContext << 1; $i >= 0; --$i) { if (isset($src[$i][$ltrim]) && "\r" !== ($c = $src[$i][$ltrim]) && "\n" !== $c) { - if (null === $pad) { - $pad = $c; - } + $pad ??= $c; if ((' ' !== $c && "\t" !== $c) || $pad !== $c) { break; } diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/FFICaster.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/FFICaster.php new file mode 100644 index 000000000..f1984eef3 --- /dev/null +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/FFICaster.php @@ -0,0 +1,161 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use FFI\CData; +use FFI\CType; +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Casts FFI extension classes to array representation. + * + * @author Nesmeyanov Kirill + */ +final class FFICaster +{ + /** + * In case of "char*" contains a string, the length of which depends on + * some other parameter, then during the generation of the string it is + * possible to go beyond the allowable memory area. + * + * This restriction serves to ensure that processing does not take + * up the entire allowable PHP memory limit. + */ + private const MAX_STRING_LENGTH = 255; + + public static function castCTypeOrCData(CData|CType $data, array $args, Stub $stub): array + { + if ($data instanceof CType) { + $type = $data; + $data = null; + } else { + $type = \FFI::typeof($data); + } + + $stub->class = sprintf('%s<%s> size %d align %d', ($data ?? $type)::class, $type->getName(), $type->getSize(), $type->getAlignment()); + + return match ($type->getKind()) { + CType::TYPE_FLOAT, + CType::TYPE_DOUBLE, + \defined('\FFI\CType::TYPE_LONGDOUBLE') ? CType::TYPE_LONGDOUBLE : -1, + CType::TYPE_UINT8, + CType::TYPE_SINT8, + CType::TYPE_UINT16, + CType::TYPE_SINT16, + CType::TYPE_UINT32, + CType::TYPE_SINT32, + CType::TYPE_UINT64, + CType::TYPE_SINT64, + CType::TYPE_BOOL, + CType::TYPE_CHAR, + CType::TYPE_ENUM => null !== $data ? [Caster::PREFIX_VIRTUAL.'cdata' => $data->cdata] : [], + CType::TYPE_POINTER => self::castFFIPointer($stub, $type, $data), + CType::TYPE_STRUCT => self::castFFIStructLike($type, $data), + CType::TYPE_FUNC => self::castFFIFunction($stub, $type), + default => $args, + }; + } + + private static function castFFIFunction(Stub $stub, CType $type): array + { + $arguments = []; + + for ($i = 0, $count = $type->getFuncParameterCount(); $i < $count; ++$i) { + $param = $type->getFuncParameterType($i); + + $arguments[] = $param->getName(); + } + + $abi = match ($type->getFuncABI()) { + CType::ABI_DEFAULT, + CType::ABI_CDECL => '[cdecl]', + CType::ABI_FASTCALL => '[fastcall]', + CType::ABI_THISCALL => '[thiscall]', + CType::ABI_STDCALL => '[stdcall]', + CType::ABI_PASCAL => '[pascal]', + CType::ABI_REGISTER => '[register]', + CType::ABI_MS => '[ms]', + CType::ABI_SYSV => '[sysv]', + CType::ABI_VECTORCALL => '[vectorcall]', + default => '[unknown abi]' + }; + + $returnType = $type->getFuncReturnType(); + + $stub->class = $abi.' callable('.implode(', ', $arguments).'): ' + .$returnType->getName(); + + return [Caster::PREFIX_VIRTUAL.'returnType' => $returnType]; + } + + private static function castFFIPointer(Stub $stub, CType $type, ?CData $data = null): array + { + $ptr = $type->getPointerType(); + + if (null === $data) { + return [Caster::PREFIX_VIRTUAL.'0' => $ptr]; + } + + return match ($ptr->getKind()) { + CType::TYPE_CHAR => [Caster::PREFIX_VIRTUAL.'cdata' => self::castFFIStringValue($data)], + CType::TYPE_FUNC => self::castFFIFunction($stub, $ptr), + default => [Caster::PREFIX_VIRTUAL.'cdata' => $data[0]], + }; + } + + private static function castFFIStringValue(CData $data): string|CutStub + { + $result = []; + + for ($i = 0; $i < self::MAX_STRING_LENGTH; ++$i) { + $result[$i] = $data[$i]; + + if ("\0" === $result[$i]) { + return implode('', $result); + } + } + + $string = implode('', $result); + $stub = new CutStub($string); + $stub->cut = -1; + $stub->value = $string; + + return $stub; + } + + private static function castFFIStructLike(CType $type, ?CData $data = null): array + { + $isUnion = ($type->getAttributes() & CType::ATTR_UNION) === CType::ATTR_UNION; + + $result = []; + + foreach ($type->getStructFieldNames() as $name) { + $field = $type->getStructFieldType($name); + + // Retrieving the value of a field from a union containing + // a pointer is not a safe operation, because may contain + // incorrect data. + $isUnsafe = $isUnion && CType::TYPE_POINTER === $field->getKind(); + + if ($isUnsafe) { + $result[Caster::PREFIX_VIRTUAL.$name.'?'] = $field; + } elseif (null === $data) { + $result[Caster::PREFIX_VIRTUAL.$name] = $field; + } else { + $fieldName = $data->{$name} instanceof CData ? '' : $field->getName().' '; + $result[Caster::PREFIX_VIRTUAL.$fieldName.$name] = $data->{$name}; + } + } + + return $result; + } +} diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/FiberCaster.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/FiberCaster.php index c74a9e59c..b797dbd63 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/FiberCaster.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/FiberCaster.php @@ -20,6 +20,9 @@ use Symfony\Component\VarDumper\Cloner\Stub; */ final class FiberCaster { + /** + * @return array + */ public static function castFiber(\Fiber $fiber, array $a, Stub $stub, bool $isNested, int $filter = 0) { $prefix = Caster::PREFIX_VIRTUAL; diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/IntlCaster.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/IntlCaster.php index 23b9d5da3..a4590f4b5 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/IntlCaster.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/IntlCaster.php @@ -21,6 +21,9 @@ use Symfony\Component\VarDumper\Cloner\Stub; */ class IntlCaster { + /** + * @return array + */ public static function castMessageFormatter(\MessageFormatter $c, array $a, Stub $stub, bool $isNested) { $a += [ @@ -31,6 +34,9 @@ class IntlCaster return self::castError($c, $a); } + /** + * @return array + */ public static function castNumberFormatter(\NumberFormatter $c, array $a, Stub $stub, bool $isNested, int $filter = 0) { $a += [ @@ -102,12 +108,15 @@ class IntlCaster 'SIGNIFICANT_DIGIT_SYMBOL' => $c->getSymbol(\NumberFormatter::SIGNIFICANT_DIGIT_SYMBOL), 'MONETARY_GROUPING_SEPARATOR_SYMBOL' => $c->getSymbol(\NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL), ] - ), + ), ]; return self::castError($c, $a); } + /** + * @return array + */ public static function castIntlTimeZone(\IntlTimeZone $c, array $a, Stub $stub, bool $isNested) { $a += [ @@ -125,6 +134,9 @@ class IntlCaster return self::castError($c, $a); } + /** + * @return array + */ public static function castIntlCalendar(\IntlCalendar $c, array $a, Stub $stub, bool $isNested, int $filter = 0) { $a += [ @@ -142,6 +154,9 @@ class IntlCaster return self::castError($c, $a); } + /** + * @return array + */ public static function castIntlDateFormatter(\IntlDateFormatter $c, array $a, Stub $stub, bool $isNested, int $filter = 0) { $a += [ diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/LinkStub.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/LinkStub.php index 36e0d3cb9..4930436df 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/LinkStub.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/LinkStub.php @@ -23,14 +23,11 @@ class LinkStub extends ConstStub private static array $vendorRoots; private static array $composerRoots = []; - public function __construct(string $label, int $line = 0, string $href = null) + public function __construct(string $label, int $line = 0, ?string $href = null) { $this->value = $label; - if (null === $href) { - $href = $label; - } - if (!\is_string($href)) { + if (!\is_string($href ??= $label)) { return; } if (str_starts_with($href, 'file://')) { @@ -63,7 +60,7 @@ class LinkStub extends ConstStub } } - private function getComposerRoot(string $file, bool &$inVendor) + private function getComposerRoot(string $file, bool &$inVendor): string|false { if (!isset(self::$vendorRoots)) { self::$vendorRoots = []; diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/MemcachedCaster.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/MemcachedCaster.php index d6baa2514..2f161e8cb 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/MemcachedCaster.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/MemcachedCaster.php @@ -23,6 +23,9 @@ class MemcachedCaster private static array $optionConstants; private static array $defaultOptions; + /** + * @return array + */ public static function castMemcached(\Memcached $c, array $a, Stub $stub, bool $isNested) { $a += [ @@ -37,8 +40,8 @@ class MemcachedCaster private static function getNonDefaultOptions(\Memcached $c): array { - self::$defaultOptions = self::$defaultOptions ?? self::discoverDefaultOptions(); - self::$optionConstants = self::$optionConstants ?? self::getOptionConstants(); + self::$defaultOptions ??= self::discoverDefaultOptions(); + self::$optionConstants ??= self::getOptionConstants(); $nonDefaultOptions = []; foreach (self::$optionConstants as $constantKey => $value) { @@ -56,7 +59,7 @@ class MemcachedCaster $defaultMemcached->addServer('127.0.0.1', 11211); $defaultOptions = []; - self::$optionConstants = self::$optionConstants ?? self::getOptionConstants(); + self::$optionConstants ??= self::getOptionConstants(); foreach (self::$optionConstants as $constantKey => $value) { $defaultOptions[$constantKey] = $defaultMemcached->getOption($value); diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/PdoCaster.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/PdoCaster.php index 140473b53..d68eae216 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/PdoCaster.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/PdoCaster.php @@ -59,6 +59,9 @@ class PdoCaster ], ]; + /** + * @return array + */ public static function castPdo(\PDO $c, array $a, Stub $stub, bool $isNested) { $attr = []; @@ -76,7 +79,7 @@ class PdoCaster if ($v && isset($v[$attr[$k]])) { $attr[$k] = new ConstStub($v[$attr[$k]], $attr[$k]); } - } catch (\Exception $e) { + } catch (\Exception) { } } if (isset($attr[$k = 'STATEMENT_CLASS'][1])) { @@ -108,6 +111,9 @@ class PdoCaster return $a; } + /** + * @return array + */ public static function castPdoStatement(\PDOStatement $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/PgSqlCaster.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/PgSqlCaster.php index d8e5b5253..0d8b3d919 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/PgSqlCaster.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/PgSqlCaster.php @@ -69,6 +69,9 @@ class PgSqlCaster 'function' => \PGSQL_DIAG_SOURCE_FUNCTION, ]; + /** + * @return array + */ public static function castLargeObject($lo, array $a, Stub $stub, bool $isNested) { $a['seek position'] = pg_lo_tell($lo); @@ -76,6 +79,9 @@ class PgSqlCaster return $a; } + /** + * @return array + */ public static function castLink($link, array $a, Stub $stub, bool $isNested) { $a['status'] = pg_connection_status($link); @@ -108,6 +114,9 @@ class PgSqlCaster return $a; } + /** + * @return array + */ public static function castResult($result, array $a, Stub $stub, bool $isNested) { $a['num rows'] = pg_num_rows($result); diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ProxyManagerCaster.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ProxyManagerCaster.php index e7120191f..eb6c88db6 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ProxyManagerCaster.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ProxyManagerCaster.php @@ -21,6 +21,9 @@ use Symfony\Component\VarDumper\Cloner\Stub; */ class ProxyManagerCaster { + /** + * @return array + */ public static function castProxy(ProxyInterface $c, array $a, Stub $stub, bool $isNested) { if ($parent = get_parent_class($c)) { diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/RdKafkaCaster.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/RdKafkaCaster.php index 805336395..fcaa1b768 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/RdKafkaCaster.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/RdKafkaCaster.php @@ -31,13 +31,16 @@ use Symfony\Component\VarDumper\Cloner\Stub; */ class RdKafkaCaster { + /** + * @return array + */ public static function castKafkaConsumer(KafkaConsumer $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; try { $assignment = $c->getAssignment(); - } catch (RdKafkaException $e) { + } catch (RdKafkaException) { $assignment = []; } @@ -51,6 +54,9 @@ class RdKafkaCaster return $a; } + /** + * @return array + */ public static function castTopic(Topic $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -62,6 +68,9 @@ class RdKafkaCaster return $a; } + /** + * @return array + */ public static function castTopicPartition(TopicPartition $c, array $a) { $prefix = Caster::PREFIX_VIRTUAL; @@ -75,6 +84,9 @@ class RdKafkaCaster return $a; } + /** + * @return array + */ public static function castMessage(Message $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -86,6 +98,9 @@ class RdKafkaCaster return $a; } + /** + * @return array + */ public static function castConf(Conf $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -97,6 +112,9 @@ class RdKafkaCaster return $a; } + /** + * @return array + */ public static function castTopicConf(TopicConf $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -108,6 +126,9 @@ class RdKafkaCaster return $a; } + /** + * @return array + */ public static function castRdKafka(\RdKafka $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -121,6 +142,9 @@ class RdKafkaCaster return $a; } + /** + * @return array + */ public static function castCollectionMetadata(CollectionMetadata $c, array $a, Stub $stub, bool $isNested) { $a += iterator_to_array($c); @@ -128,6 +152,9 @@ class RdKafkaCaster return $a; } + /** + * @return array + */ public static function castTopicMetadata(TopicMetadata $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -140,6 +167,9 @@ class RdKafkaCaster return $a; } + /** + * @return array + */ public static function castPartitionMetadata(PartitionMetadata $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -153,6 +183,9 @@ class RdKafkaCaster return $a; } + /** + * @return array + */ public static function castBrokerMetadata(BrokerMetadata $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -166,13 +199,16 @@ class RdKafkaCaster return $a; } + /** + * @return array + */ private static function extractMetadata(KafkaConsumer|\RdKafka $c) { $prefix = Caster::PREFIX_VIRTUAL; try { $m = $c->getMetadata(true, null, 500); - } catch (RdKafkaException $e) { + } catch (RdKafkaException) { return []; } diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/RedisCaster.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/RedisCaster.php index eac25a12a..6ff046754 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/RedisCaster.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/RedisCaster.php @@ -11,6 +11,7 @@ namespace Symfony\Component\VarDumper\Caster; +use Relay\Relay; use Symfony\Component\VarDumper\Cloner\Stub; /** @@ -23,15 +24,15 @@ use Symfony\Component\VarDumper\Cloner\Stub; class RedisCaster { private const SERIALIZERS = [ - \Redis::SERIALIZER_NONE => 'NONE', - \Redis::SERIALIZER_PHP => 'PHP', + 0 => 'NONE', // Redis::SERIALIZER_NONE + 1 => 'PHP', // Redis::SERIALIZER_PHP 2 => 'IGBINARY', // Optional Redis::SERIALIZER_IGBINARY ]; private const MODES = [ - \Redis::ATOMIC => 'ATOMIC', - \Redis::MULTI => 'MULTI', - \Redis::PIPELINE => 'PIPELINE', + 0 => 'ATOMIC', // Redis::ATOMIC + 1 => 'MULTI', // Redis::MULTI + 2 => 'PIPELINE', // Redis::PIPELINE ]; private const COMPRESSION_MODES = [ @@ -46,7 +47,10 @@ class RedisCaster \RedisCluster::FAILOVER_DISTRIBUTE_SLAVES => 'DISTRIBUTE_SLAVES', ]; - public static function castRedis(\Redis $c, array $a, Stub $stub, bool $isNested) + /** + * @return array + */ + public static function castRedis(\Redis|Relay $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -72,6 +76,9 @@ class RedisCaster ]; } + /** + * @return array + */ public static function castRedisArray(\RedisArray $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -84,6 +91,9 @@ class RedisCaster ]; } + /** + * @return array + */ public static function castRedisCluster(\RedisCluster $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -102,9 +112,9 @@ class RedisCaster return $a; } - private static function getRedisOptions(\Redis|\RedisArray|\RedisCluster $redis, array $options = []): EnumStub + private static function getRedisOptions(\Redis|Relay|\RedisArray|\RedisCluster $redis, array $options = []): EnumStub { - $serializer = $redis->getOption(\Redis::OPT_SERIALIZER); + $serializer = $redis->getOption(\defined('Redis::OPT_SERIALIZER') ? \Redis::OPT_SERIALIZER : 1); if (\is_array($serializer)) { foreach ($serializer as &$v) { if (isset(self::SERIALIZERS[$v])) { @@ -136,11 +146,11 @@ class RedisCaster } $options += [ - 'TCP_KEEPALIVE' => \defined('Redis::OPT_TCP_KEEPALIVE') ? $redis->getOption(\Redis::OPT_TCP_KEEPALIVE) : 0, - 'READ_TIMEOUT' => $redis->getOption(\Redis::OPT_READ_TIMEOUT), + 'TCP_KEEPALIVE' => \defined('Redis::OPT_TCP_KEEPALIVE') ? $redis->getOption(\Redis::OPT_TCP_KEEPALIVE) : Relay::OPT_TCP_KEEPALIVE, + 'READ_TIMEOUT' => $redis->getOption(\defined('Redis::OPT_READ_TIMEOUT') ? \Redis::OPT_READ_TIMEOUT : Relay::OPT_READ_TIMEOUT), 'COMPRESSION' => $compression, 'SERIALIZER' => $serializer, - 'PREFIX' => $redis->getOption(\Redis::OPT_PREFIX), + 'PREFIX' => $redis->getOption(\defined('Redis::OPT_PREFIX') ? \Redis::OPT_PREFIX : Relay::OPT_PREFIX), 'SCAN' => $retry, ]; diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ReflectionCaster.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ReflectionCaster.php index 86d439f2b..4adb9bc9f 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ReflectionCaster.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ReflectionCaster.php @@ -35,6 +35,9 @@ class ReflectionCaster 'isVariadic' => 'isVariadic', ]; + /** + * @return array + */ public static function castClosure(\Closure $c, array $a, Stub $stub, bool $isNested, int $filter = 0) { $prefix = Caster::PREFIX_VIRTUAL; @@ -71,6 +74,9 @@ class ReflectionCaster return $a; } + /** + * @return array + */ public static function unsetClosureFileInfo(\Closure $c, array $a) { unset($a[Caster::PREFIX_VIRTUAL.'file'], $a[Caster::PREFIX_VIRTUAL.'line']); @@ -78,12 +84,12 @@ class ReflectionCaster return $a; } - public static function castGenerator(\Generator $c, array $a, Stub $stub, bool $isNested) + public static function castGenerator(\Generator $c, array $a, Stub $stub, bool $isNested): array { // Cannot create ReflectionGenerator based on a terminated Generator try { $reflectionGenerator = new \ReflectionGenerator($c); - } catch (\Exception $e) { + } catch (\Exception) { $a[Caster::PREFIX_VIRTUAL.'closed'] = true; return $a; @@ -92,6 +98,9 @@ class ReflectionCaster return self::castReflectionGenerator($reflectionGenerator, $a, $stub, $isNested); } + /** + * @return array + */ public static function castType(\ReflectionType $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -114,6 +123,9 @@ class ReflectionCaster return $a; } + /** + * @return array + */ public static function castAttribute(\ReflectionAttribute $c, array $a, Stub $stub, bool $isNested) { self::addMap($a, $c, [ @@ -124,6 +136,9 @@ class ReflectionCaster return $a; } + /** + * @return array + */ public static function castReflectionGenerator(\ReflectionGenerator $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -144,7 +159,7 @@ class ReflectionCaster array_unshift($trace, [ 'function' => 'yield', 'file' => $function->getExecutingFile(), - 'line' => $function->getExecutingLine() - (int) (\PHP_VERSION_ID < 80100), + 'line' => $function->getExecutingLine(), ]); $trace[] = $frame; $a[$prefix.'trace'] = new TraceStub($trace, false, 0, -1, -1); @@ -159,6 +174,9 @@ class ReflectionCaster return $a; } + /** + * @return array + */ public static function castClass(\ReflectionClass $c, array $a, Stub $stub, bool $isNested, int $filter = 0) { $prefix = Caster::PREFIX_VIRTUAL; @@ -190,6 +208,9 @@ class ReflectionCaster return $a; } + /** + * @return array + */ public static function castFunctionAbstract(\ReflectionFunctionAbstract $c, array $a, Stub $stub, bool $isNested, int $filter = 0) { $prefix = Caster::PREFIX_VIRTUAL; @@ -197,7 +218,7 @@ class ReflectionCaster self::addMap($a, $c, [ 'returnsReference' => 'returnsReference', 'returnType' => 'getReturnType', - 'class' => 'getClosureScopeClass', + 'class' => \PHP_VERSION_ID >= 80111 ? 'getClosureCalledClass' : 'getClosureScopeClass', 'this' => 'getClosureThis', ]); @@ -248,6 +269,9 @@ class ReflectionCaster return $a; } + /** + * @return array + */ public static function castClassConstant(\ReflectionClassConstant $c, array $a, Stub $stub, bool $isNested) { $a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers())); @@ -258,6 +282,9 @@ class ReflectionCaster return $a; } + /** + * @return array + */ public static function castMethod(\ReflectionMethod $c, array $a, Stub $stub, bool $isNested) { $a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers())); @@ -265,6 +292,9 @@ class ReflectionCaster return $a; } + /** + * @return array + */ public static function castParameter(\ReflectionParameter $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -292,19 +322,22 @@ class ReflectionCaster if ($c->isOptional()) { try { $a[$prefix.'default'] = $v = $c->getDefaultValue(); - if ($c->isDefaultValueConstant()) { + if ($c->isDefaultValueConstant() && !\is_object($v)) { $a[$prefix.'default'] = new ConstStub($c->getDefaultValueConstantName(), $v); } if (null === $v) { unset($a[$prefix.'allowsNull']); } - } catch (\ReflectionException $e) { + } catch (\ReflectionException) { } } return $a; } + /** + * @return array + */ public static function castProperty(\ReflectionProperty $c, array $a, Stub $stub, bool $isNested) { $a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers())); @@ -315,6 +348,9 @@ class ReflectionCaster return $a; } + /** + * @return array + */ public static function castReference(\ReflectionReference $c, array $a, Stub $stub, bool $isNested) { $a[Caster::PREFIX_VIRTUAL.'id'] = $c->getId(); @@ -322,6 +358,9 @@ class ReflectionCaster return $a; } + /** + * @return array + */ public static function castExtension(\ReflectionExtension $c, array $a, Stub $stub, bool $isNested) { self::addMap($a, $c, [ @@ -338,6 +377,9 @@ class ReflectionCaster return $a; } + /** + * @return array + */ public static function castZendExtension(\ReflectionZendExtension $c, array $a, Stub $stub, bool $isNested) { self::addMap($a, $c, [ @@ -350,6 +392,9 @@ class ReflectionCaster return $a; } + /** + * @return string + */ public static function getSignature(array $a) { $prefix = Caster::PREFIX_VIRTUAL; @@ -402,7 +447,7 @@ class ReflectionCaster return $signature; } - private static function addExtra(array &$a, \Reflector $c) + private static function addExtra(array &$a, \Reflector $c): void { $x = isset($a[Caster::PREFIX_VIRTUAL.'extra']) ? $a[Caster::PREFIX_VIRTUAL.'extra']->value : []; @@ -418,7 +463,7 @@ class ReflectionCaster } } - private static function addMap(array &$a, object $c, array $map, string $prefix = Caster::PREFIX_VIRTUAL) + private static function addMap(array &$a, object $c, array $map, string $prefix = Caster::PREFIX_VIRTUAL): void { foreach ($map as $k => $m) { if ('isDisabled' === $k) { diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ResourceCaster.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ResourceCaster.php index 4e597f86d..f3bbf3be4 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ResourceCaster.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ResourceCaster.php @@ -27,6 +27,9 @@ class ResourceCaster return curl_getinfo($h); } + /** + * @return array + */ public static function castDba($dba, array $a, Stub $stub, bool $isNested) { $list = dba_list(); @@ -35,12 +38,15 @@ class ResourceCaster return $a; } + /** + * @return array + */ public static function castProcess($process, array $a, Stub $stub, bool $isNested) { return proc_get_status($process); } - public static function castStream($stream, array $a, Stub $stub, bool $isNested) + public static function castStream($stream, array $a, Stub $stub, bool $isNested): array { $a = stream_get_meta_data($stream) + static::castStreamContext($stream, $a, $stub, $isNested); if ($a['uri'] ?? false) { @@ -50,11 +56,17 @@ class ResourceCaster return $a; } + /** + * @return array + */ public static function castStreamContext($stream, array $a, Stub $stub, bool $isNested) { return @stream_context_get_params($stream) ?: $a; } + /** + * @return array + */ public static function castGd($gd, array $a, Stub $stub, bool $isNested) { $a['size'] = imagesx($gd).'x'.imagesy($gd); @@ -63,15 +75,9 @@ class ResourceCaster return $a; } - public static function castMysqlLink($h, array $a, Stub $stub, bool $isNested) - { - $a['host'] = mysql_get_host_info($h); - $a['protocol'] = mysql_get_proto_info($h); - $a['server'] = mysql_get_server_info($h); - - return $a; - } - + /** + * @return array + */ public static function castOpensslX509($h, array $a, Stub $stub, bool $isNested) { $stub->cut = -1; @@ -86,7 +92,7 @@ class ResourceCaster $a += [ 'subject' => new EnumStub(array_intersect_key($info['subject'], ['organizationName' => true, 'commonName' => true])), 'issuer' => new EnumStub(array_intersect_key($info['issuer'], ['organizationName' => true, 'commonName' => true])), - 'expiry' => new ConstStub(date(\DateTime::ISO8601, $info['validTo_time_t']), $info['validTo_time_t']), + 'expiry' => new ConstStub(date(\DateTimeInterface::ISO8601, $info['validTo_time_t']), $info['validTo_time_t']), 'fingerprint' => new EnumStub([ 'md5' => new ConstStub(wordwrap(strtoupper(openssl_x509_fingerprint($h, 'md5')), 2, ':', true)), 'sha1' => new ConstStub(wordwrap(strtoupper(openssl_x509_fingerprint($h, 'sha1')), 2, ':', true)), diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ScalarStub.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ScalarStub.php new file mode 100644 index 000000000..3bb1935b8 --- /dev/null +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/ScalarStub.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +use Symfony\Component\VarDumper\Cloner\Stub; + +/** + * Represents any arbitrary value. + * + * @author Alexandre Daubois + */ +class ScalarStub extends Stub +{ + public function __construct(mixed $value) + { + $this->value = $value; + } +} diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/SplCaster.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/SplCaster.php index a51cace1d..814d824d1 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/SplCaster.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/SplCaster.php @@ -29,16 +29,25 @@ class SplCaster \SplFileObject::READ_CSV => 'READ_CSV', ]; + /** + * @return array + */ public static function castArrayObject(\ArrayObject $c, array $a, Stub $stub, bool $isNested) { return self::castSplArray($c, $a, $stub, $isNested); } + /** + * @return array + */ public static function castArrayIterator(\ArrayIterator $c, array $a, Stub $stub, bool $isNested) { return self::castSplArray($c, $a, $stub, $isNested); } + /** + * @return array + */ public static function castHeap(\Iterator $c, array $a, Stub $stub, bool $isNested) { $a += [ @@ -48,6 +57,9 @@ class SplCaster return $a; } + /** + * @return array + */ public static function castDoublyLinkedList(\SplDoublyLinkedList $c, array $a, Stub $stub, bool $isNested) { $prefix = Caster::PREFIX_VIRTUAL; @@ -63,6 +75,9 @@ class SplCaster return $a; } + /** + * @return array + */ public static function castFileInfo(\SplFileInfo $c, array $a, Stub $stub, bool $isNested) { static $map = [ @@ -117,7 +132,7 @@ class SplCaster foreach ($map as $key => $accessor) { try { $a[$prefix.$key] = $c->$accessor(); - } catch (\Exception $e) { + } catch (\Exception) { } } @@ -139,6 +154,9 @@ class SplCaster return $a; } + /** + * @return array + */ public static function castFileObject(\SplFileObject $c, array $a, Stub $stub, bool $isNested) { static $map = [ @@ -155,7 +173,7 @@ class SplCaster foreach ($map as $key => $accessor) { try { $a[$prefix.$key] = $c->$accessor(); - } catch (\Exception $e) { + } catch (\Exception) { } } @@ -176,6 +194,9 @@ class SplCaster return $a; } + /** + * @return array + */ public static function castObjectStorage(\SplObjectStorage $c, array $a, Stub $stub, bool $isNested) { $storage = []; @@ -184,10 +205,10 @@ class SplCaster $clone = clone $c; foreach ($clone as $obj) { - $storage[] = [ + $storage[] = new EnumStub([ 'object' => $obj, 'info' => $clone->getInfo(), - ]; + ]); } $a += [ @@ -197,6 +218,9 @@ class SplCaster return $a; } + /** + * @return array + */ public static function castOuterIterator(\OuterIterator $c, array $a, Stub $stub, bool $isNested) { $a[Caster::PREFIX_VIRTUAL.'innerIterator'] = $c->getInnerIterator(); @@ -204,6 +228,9 @@ class SplCaster return $a; } + /** + * @return array + */ public static function castWeakReference(\WeakReference $c, array $a, Stub $stub, bool $isNested) { $a[Caster::PREFIX_VIRTUAL.'object'] = $c->get(); @@ -211,6 +238,27 @@ class SplCaster return $a; } + /** + * @return array + */ + public static function castWeakMap(\WeakMap $c, array $a, Stub $stub, bool $isNested) + { + $map = []; + + foreach (clone $c as $obj => $data) { + $map[] = new EnumStub([ + 'object' => $obj, + 'data' => $data, + ]); + } + + $a += [ + Caster::PREFIX_VIRTUAL.'map' => $map, + ]; + + return $a; + } + private static function castSplArray(\ArrayObject|\ArrayIterator $c, array $a, Stub $stub, bool $isNested): array { $prefix = Caster::PREFIX_VIRTUAL; @@ -218,10 +266,14 @@ class SplCaster if (!($flags & \ArrayObject::STD_PROP_LIST)) { $c->setFlags(\ArrayObject::STD_PROP_LIST); - $a = Caster::castObject($c, \get_class($c), method_exists($c, '__debugInfo'), $stub->class); + $a = Caster::castObject($c, $c::class, method_exists($c, '__debugInfo'), $stub->class); $c->setFlags($flags); } + + unset($a["\0ArrayObject\0storage"], $a["\0ArrayIterator\0storage"]); + $a += [ + $prefix.'storage' => $c->getArrayCopy(), $prefix.'flag::STD_PROP_LIST' => (bool) ($flags & \ArrayObject::STD_PROP_LIST), $prefix.'flag::ARRAY_AS_PROPS' => (bool) ($flags & \ArrayObject::ARRAY_AS_PROPS), ]; diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/StubCaster.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/StubCaster.php index 32ead7c27..4b93ff76f 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/StubCaster.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/StubCaster.php @@ -22,6 +22,9 @@ use Symfony\Component\VarDumper\Cloner\Stub; */ class StubCaster { + /** + * @return array + */ public static function castStub(Stub $c, array $a, Stub $stub, bool $isNested) { if ($isNested) { @@ -43,11 +46,17 @@ class StubCaster return $a; } + /** + * @return array + */ public static function castCutArray(CutArrayStub $c, array $a, Stub $stub, bool $isNested) { return $isNested ? $c->preservedSubset : $a; } + /** + * @return array + */ public static function cutInternals($obj, array $a, Stub $stub, bool $isNested) { if ($isNested) { @@ -59,6 +68,9 @@ class StubCaster return $a; } + /** + * @return array + */ public static function castEnum(EnumStub $c, array $a, Stub $stub, bool $isNested) { if ($isNested) { @@ -81,4 +93,15 @@ class StubCaster return $a; } + + /** + * @return array + */ + public static function castScalar(ScalarStub $scalarStub, array $a, Stub $stub) + { + $stub->type = Stub::TYPE_SCALAR; + $stub->attr['value'] = $scalarStub->value; + + return $a; + } } diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/SymfonyCaster.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/SymfonyCaster.php index 08428b927..ebc00f90e 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/SymfonyCaster.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/SymfonyCaster.php @@ -15,6 +15,7 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Uid\Ulid; use Symfony\Component\Uid\Uuid; use Symfony\Component\VarDumper\Cloner\Stub; +use Symfony\Component\VarExporter\Internal\LazyObjectState; /** * @final @@ -30,6 +31,9 @@ class SymfonyCaster 'format' => 'getRequestFormat', ]; + /** + * @return array + */ public static function castRequest(Request $request, array $a, Stub $stub, bool $isNested) { $clone = null; @@ -37,9 +41,7 @@ class SymfonyCaster foreach (self::REQUEST_GETTERS as $prop => $getter) { $key = Caster::PREFIX_PROTECTED.$prop; if (\array_key_exists($key, $a) && null === $a[$key]) { - if (null === $clone) { - $clone = clone $request; - } + $clone ??= clone $request; $a[Caster::PREFIX_VIRTUAL.$prop] = $clone->{$getter}(); } } @@ -47,9 +49,12 @@ class SymfonyCaster return $a; } + /** + * @return array + */ public static function castHttpClient($client, array $a, Stub $stub, bool $isNested) { - $multiKey = sprintf("\0%s\0multi", \get_class($client)); + $multiKey = sprintf("\0%s\0multi", $client::class); if (isset($a[$multiKey])) { $a[$multiKey] = new CutStub($a[$multiKey]); } @@ -57,6 +62,9 @@ class SymfonyCaster return $a; } + /** + * @return array + */ public static function castHttpClientResponse($response, array $a, Stub $stub, bool $isNested) { $stub->cut += \count($a); @@ -69,6 +77,37 @@ class SymfonyCaster return $a; } + /** + * @return array + */ + public static function castLazyObjectState($state, array $a, Stub $stub, bool $isNested) + { + if (!$isNested) { + return $a; + } + + $stub->cut += \count($a) - 1; + + $instance = $a['realInstance'] ?? null; + + $a = ['status' => new ConstStub(match ($a['status']) { + LazyObjectState::STATUS_INITIALIZED_FULL => 'INITIALIZED_FULL', + LazyObjectState::STATUS_INITIALIZED_PARTIAL => 'INITIALIZED_PARTIAL', + LazyObjectState::STATUS_UNINITIALIZED_FULL => 'UNINITIALIZED_FULL', + LazyObjectState::STATUS_UNINITIALIZED_PARTIAL => 'UNINITIALIZED_PARTIAL', + }, $a['status'])]; + + if ($instance) { + $a['realInstance'] = $instance; + --$stub->cut; + } + + return $a; + } + + /** + * @return array + */ public static function castUuid(Uuid $uuid, array $a, Stub $stub, bool $isNested) { $a[Caster::PREFIX_VIRTUAL.'toBase58'] = $uuid->toBase58(); @@ -82,6 +121,9 @@ class SymfonyCaster return $a; } + /** + * @return array + */ public static function castUlid(Ulid $ulid, array $a, Stub $stub, bool $isNested) { $a[Caster::PREFIX_VIRTUAL.'toBase58'] = $ulid->toBase58(); diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/TraceStub.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/TraceStub.php index 5eea1c876..d215d8db0 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/TraceStub.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/TraceStub.php @@ -25,7 +25,7 @@ class TraceStub extends Stub public $sliceLength; public $numberingOffset; - public function __construct(array $trace, bool $keepArgs = true, int $sliceOffset = 0, int $sliceLength = null, int $numberingOffset = 0) + public function __construct(array $trace, bool $keepArgs = true, int $sliceOffset = 0, ?int $sliceLength = null, int $numberingOffset = 0) { $this->value = $trace; $this->keepArgs = $keepArgs; diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/UninitializedStub.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/UninitializedStub.php new file mode 100644 index 000000000..a9bdd9b81 --- /dev/null +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/UninitializedStub.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Caster; + +/** + * Represents an uninitialized property. + * + * @author Nicolas Grekas + */ +class UninitializedStub extends ConstStub +{ + public function __construct(\ReflectionProperty $property) + { + parent::__construct('?'.($property->hasType() ? ' '.$property->getType() : ''), 'Uninitialized property'); + } +} diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/XmlReaderCaster.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/XmlReaderCaster.php index 721513c5d..1cfcf4dd8 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/XmlReaderCaster.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/XmlReaderCaster.php @@ -1,4 +1,5 @@ 'XML_DECLARATION', ]; + /** + * @return array + */ public static function castXmlReader(\XMLReader $reader, array $a, Stub $stub, bool $isNested) { try { @@ -51,7 +55,7 @@ class XmlReaderCaster 'VALIDATE' => @$reader->getParserProperty(\XMLReader::VALIDATE), 'SUBST_ENTITIES' => @$reader->getParserProperty(\XMLReader::SUBST_ENTITIES), ]; - } catch (\Error $e) { + } catch (\Error) { $properties = [ 'LOADDTD' => false, 'DEFAULTATTRS' => false, @@ -81,6 +85,7 @@ class XmlReaderCaster $info[$props]->cut = $count; } + $a = Caster::filter($a, Caster::EXCLUDE_UNINITIALIZED, [], $count); $info = Caster::filter($info, Caster::EXCLUDE_EMPTY, [], $count); // +2 because hasValue and hasAttributes are always filtered $stub->cut += $count + 2; diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/XmlResourceCaster.php b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/XmlResourceCaster.php index ba55fcedd..0cf42584a 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Caster/XmlResourceCaster.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Caster/XmlResourceCaster.php @@ -47,6 +47,9 @@ class XmlResourceCaster \XML_ERROR_EXTERNAL_ENTITY_HANDLING => 'XML_ERROR_EXTERNAL_ENTITY_HANDLING', ]; + /** + * @return array + */ public static function castXml($h, array $a, Stub $stub, bool $isNested) { $a['current_byte_index'] = xml_get_current_byte_index($h); diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Cloner/AbstractCloner.php b/data/web/inc/lib/vendor/symfony/var-dumper/Cloner/AbstractCloner.php index b835c0336..fc330bae2 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Cloner/AbstractCloner.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Cloner/AbstractCloner.php @@ -28,6 +28,7 @@ abstract class AbstractCloner implements ClonerInterface 'Symfony\Component\VarDumper\Caster\CutArrayStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castCutArray'], 'Symfony\Component\VarDumper\Caster\ConstStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'], 'Symfony\Component\VarDumper\Caster\EnumStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castEnum'], + 'Symfony\Component\VarDumper\Caster\ScalarStub' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'castScalar'], 'Fiber' => ['Symfony\Component\VarDumper\Caster\FiberCaster', 'castFiber'], @@ -66,9 +67,6 @@ abstract class AbstractCloner implements ClonerInterface 'DOMAttr' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castAttr'], 'DOMElement' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castElement'], 'DOMText' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castText'], - 'DOMTypeinfo' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castTypeinfo'], - 'DOMDomError' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDomError'], - 'DOMLocator' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castLocator'], 'DOMDocumentType' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castDocumentType'], 'DOMNotation' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castNotation'], 'DOMEntity' => ['Symfony\Component\VarDumper\Caster\DOMCaster', 'castEntity'], @@ -92,10 +90,12 @@ abstract class AbstractCloner implements ClonerInterface 'Symfony\Component\HttpFoundation\Request' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castRequest'], 'Symfony\Component\Uid\Ulid' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castUlid'], 'Symfony\Component\Uid\Uuid' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castUuid'], + 'Symfony\Component\VarExporter\Internal\LazyObjectState' => ['Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castLazyObjectState'], 'Symfony\Component\VarDumper\Exception\ThrowingCasterException' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castThrowingCasterException'], 'Symfony\Component\VarDumper\Caster\TraceStub' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castTraceStub'], 'Symfony\Component\VarDumper\Caster\FrameStub' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castFrameStub'], 'Symfony\Component\VarDumper\Cloner\AbstractCloner' => ['Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'], + 'Symfony\Component\ErrorHandler\Exception\FlattenException' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castFlattenException'], 'Symfony\Component\ErrorHandler\Exception\SilencedErrorContext' => ['Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castSilencedErrorContext'], 'Imagine\Image\ImageInterface' => ['Symfony\Component\VarDumper\Caster\ImagineCaster', 'castImage'], @@ -127,9 +127,11 @@ abstract class AbstractCloner implements ClonerInterface 'SplObjectStorage' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castObjectStorage'], 'SplPriorityQueue' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castHeap'], 'OuterIterator' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castOuterIterator'], + 'WeakMap' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castWeakMap'], 'WeakReference' => ['Symfony\Component\VarDumper\Caster\SplCaster', 'castWeakReference'], 'Redis' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedis'], + 'Relay\Relay' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedis'], 'RedisArray' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisArray'], 'RedisCluster' => ['Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisCluster'], @@ -163,7 +165,6 @@ abstract class AbstractCloner implements ClonerInterface 'GdImage' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castGd'], ':gd' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castGd'], - ':mysql link' => ['Symfony\Component\VarDumper\Caster\ResourceCaster', 'castMysqlLink'], ':pgsql large object' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLargeObject'], ':pgsql link' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLink'], ':pgsql link persistent' => ['Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLink'], @@ -191,6 +192,9 @@ abstract class AbstractCloner implements ClonerInterface 'RdKafka\Topic' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castTopic'], 'RdKafka\TopicPartition' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castTopicPartition'], 'RdKafka\TopicConf' => ['Symfony\Component\VarDumper\Caster\RdKafkaCaster', 'castTopicConf'], + + 'FFI\CData' => ['Symfony\Component\VarDumper\Caster\FFICaster', 'castCTypeOrCData'], + 'FFI\CType' => ['Symfony\Component\VarDumper\Caster\FFICaster', 'castCTypeOrCData'], ]; protected $maxItems = 2500; @@ -215,12 +219,9 @@ abstract class AbstractCloner implements ClonerInterface * * @see addCasters */ - public function __construct(array $casters = null) + public function __construct(?array $casters = null) { - if (null === $casters) { - $casters = static::$defaultCasters; - } - $this->addCasters($casters); + $this->addCasters($casters ?? static::$defaultCasters); } /** @@ -232,6 +233,8 @@ abstract class AbstractCloner implements ClonerInterface * see e.g. static::$defaultCasters. * * @param callable[] $casters A map of casters + * + * @return void */ public function addCasters(array $casters) { @@ -242,6 +245,8 @@ abstract class AbstractCloner implements ClonerInterface /** * Sets the maximum number of items to clone past the minimum depth in nested structures. + * + * @return void */ public function setMaxItems(int $maxItems) { @@ -250,6 +255,8 @@ abstract class AbstractCloner implements ClonerInterface /** * Sets the maximum cloned length for strings. + * + * @return void */ public function setMaxString(int $maxString) { @@ -259,6 +266,8 @@ abstract class AbstractCloner implements ClonerInterface /** * Sets the minimum tree depth where we are guaranteed to clone all the items. After this * depth is reached, only setMaxItems items will be cloned. + * + * @return void */ public function setMinDepth(int $minDepth) { diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Cloner/Data.php b/data/web/inc/lib/vendor/symfony/var-dumper/Cloner/Data.php index 6ecb883e8..16f51b0c7 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Cloner/Data.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Cloner/Data.php @@ -17,7 +17,7 @@ use Symfony\Component\VarDumper\Dumper\ContextProvider\SourceContextProvider; /** * @author Nicolas Grekas */ -class Data implements \ArrayAccess, \Countable, \IteratorAggregate +class Data implements \ArrayAccess, \Countable, \IteratorAggregate, \Stringable { private array $data; private int $position = 0; @@ -121,6 +121,9 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate yield from $value; } + /** + * @return mixed + */ public function __get(string $key) { if (null !== $data = $this->seek($key)) { @@ -211,6 +214,11 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate return $data; } + public function getContext(): array + { + return $this->context; + } + /** * Seeks to a specific key in nested data structures. */ @@ -257,21 +265,21 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate /** * Dumps data with a DumperInterface dumper. + * + * @return void */ public function dump(DumperInterface $dumper) { $refs = [0]; $cursor = new Cursor(); + $cursor->hashType = -1; + $cursor->attr = $this->context[SourceContextProvider::class] ?? []; + $label = $this->context['label'] ?? ''; - if ($cursor->attr = $this->context[SourceContextProvider::class] ?? []) { - $cursor->attr['if_links'] = true; - $cursor->hashType = -1; - $dumper->dumpScalar($cursor, 'default', '^'); - $cursor->attr = ['if_links' => true]; - $dumper->dumpScalar($cursor, 'default', ' '); - $cursor->hashType = 0; + if ($cursor->attr || '' !== $label) { + $dumper->dumpScalar($cursor, 'label', $label); } - + $cursor->hashType = 0; $this->dumpItem($dumper, $cursor, $refs, $this->data[$this->position][$this->key]); } @@ -280,7 +288,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate * * @param mixed $item A Stub object or the original value being dumped */ - private function dumpItem(DumperInterface $dumper, Cursor $cursor, array &$refs, mixed $item) + private function dumpItem(DumperInterface $dumper, Cursor $cursor, array &$refs, mixed $item): void { $cursor->refIndex = 0; $cursor->softRefTo = $cursor->softRefHandle = $cursor->softRefCount = 0; @@ -362,6 +370,10 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate $dumper->leaveHash($cursor, $item->type, $item->class, $withChildren, $cut); break; + case Stub::TYPE_SCALAR: + $dumper->dumpScalar($cursor, 'default', $item->attr['value']); + break; + default: throw new \RuntimeException(sprintf('Unexpected Stub type: "%s".', $item->type)); } @@ -402,7 +414,7 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate return $hashCut; } - private function getStub(mixed $item) + private function getStub(mixed $item): mixed { if (!$item || !\is_array($item)) { return $item; diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Cloner/DumperInterface.php b/data/web/inc/lib/vendor/symfony/var-dumper/Cloner/DumperInterface.php index 61d02d240..4c5b315b6 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Cloner/DumperInterface.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Cloner/DumperInterface.php @@ -20,6 +20,8 @@ interface DumperInterface { /** * Dumps a scalar value. + * + * @return void */ public function dumpScalar(Cursor $cursor, string $type, string|int|float|bool|null $value); @@ -29,6 +31,8 @@ interface DumperInterface * @param string $str The string being dumped * @param bool $bin Whether $str is UTF-8 or binary encoded * @param int $cut The number of characters $str has been cut by + * + * @return void */ public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut); @@ -38,6 +42,8 @@ interface DumperInterface * @param int $type A Cursor::HASH_* const for the type of hash * @param string|int|null $class The object class, resource type or array count * @param bool $hasChild When the dump of the hash has child item + * + * @return void */ public function enterHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild); @@ -48,6 +54,8 @@ interface DumperInterface * @param string|int|null $class The object class, resource type or array count * @param bool $hasChild When the dump of the hash has child item * @param int $cut The number of items the hash has been cut by + * + * @return void */ public function leaveHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild, int $cut); } diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Cloner/Stub.php b/data/web/inc/lib/vendor/symfony/var-dumper/Cloner/Stub.php index 1c5b88712..0c2a4b9d0 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Cloner/Stub.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Cloner/Stub.php @@ -23,6 +23,7 @@ class Stub public const TYPE_ARRAY = 3; public const TYPE_OBJECT = 4; public const TYPE_RESOURCE = 5; + public const TYPE_SCALAR = 6; public const STRING_BINARY = 1; public const STRING_UTF8 = 2; diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Cloner/VarCloner.php b/data/web/inc/lib/vendor/symfony/var-dumper/Cloner/VarCloner.php index 9afcc348a..e168d0d3b 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Cloner/VarCloner.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Cloner/VarCloner.php @@ -16,12 +16,8 @@ namespace Symfony\Component\VarDumper\Cloner; */ class VarCloner extends AbstractCloner { - private static string $gid; private static array $arrayCache = []; - /** - * {@inheritdoc} - */ protected function doClone(mixed $var): array { $len = 1; // Length of $queue @@ -44,7 +40,6 @@ class VarCloner extends AbstractCloner $stub = null; // Stub capturing the main properties of an original item value // or null if the original value is used directly - $gid = self::$gid ??= md5(random_bytes(6)); // Unique string used to detect the special $GLOBALS variable $arrayStub = new Stub(); $arrayStub->type = Stub::TYPE_ARRAY; $fromObjCast = false; @@ -121,53 +116,15 @@ class VarCloner extends AbstractCloner } $stub = $arrayStub; - if (\PHP_VERSION_ID >= 80100) { - $stub->class = array_is_list($v) ? Stub::ARRAY_INDEXED : Stub::ARRAY_ASSOC; - $a = $v; - break; - } - - $stub->class = Stub::ARRAY_INDEXED; - - $j = -1; - foreach ($v as $gk => $gv) { - if ($gk !== ++$j) { - $stub->class = Stub::ARRAY_ASSOC; - $a = $v; - $a[$gid] = true; - break; - } - } - - // Copies of $GLOBALS have very strange behavior, - // let's detect them with some black magic - if (isset($v[$gid])) { - unset($v[$gid]); - $a = []; - foreach ($v as $gk => &$gv) { - if ($v === $gv && !isset($hardRefs[\ReflectionReference::fromArrayElement($v, $gk)->getId()])) { - unset($v); - $v = new Stub(); - $v->value = [$v->cut = \count($gv), Stub::TYPE_ARRAY => 0]; - $v->handle = -1; - $gv = &$a[$gk]; - $hardRefs[\ReflectionReference::fromArrayElement($a, $gk)->getId()] = &$gv; - $gv = $v; - } - - $a[$gk] = &$gv; - } - unset($gv); - } else { - $a = $v; - } + $stub->class = array_is_list($v) ? Stub::ARRAY_INDEXED : Stub::ARRAY_ASSOC; + $a = $v; break; case \is_object($v): if (empty($objRefs[$h = spl_object_id($v)])) { $stub = new Stub(); $stub->type = Stub::TYPE_OBJECT; - $stub->class = \get_class($v); + $stub->class = $v::class; $stub->value = $v; $stub->handle = $h; $a = $this->castObject($stub, 0 < $i); diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Command/Descriptor/CliDescriptor.php b/data/web/inc/lib/vendor/symfony/var-dumper/Command/Descriptor/CliDescriptor.php index e3d5f1d11..4450fe986 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Command/Descriptor/CliDescriptor.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Command/Descriptor/CliDescriptor.php @@ -26,7 +26,7 @@ use Symfony\Component\VarDumper\Dumper\CliDumper; */ class CliDescriptor implements DumpDescriptorInterface { - private $dumper; + private CliDumper $dumper; private mixed $lastIdentifier = null; public function __construct(CliDumper $dumper) diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Command/Descriptor/HtmlDescriptor.php b/data/web/inc/lib/vendor/symfony/var-dumper/Command/Descriptor/HtmlDescriptor.php index 1c0d80a05..98f150a5e 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Command/Descriptor/HtmlDescriptor.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Command/Descriptor/HtmlDescriptor.php @@ -24,7 +24,7 @@ use Symfony\Component\VarDumper\Dumper\HtmlDumper; */ class HtmlDescriptor implements DumpDescriptorInterface { - private $dumper; + private HtmlDumper $dumper; private bool $initialized = false; public function __construct(HtmlDumper $dumper) diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Command/ServerDumpCommand.php b/data/web/inc/lib/vendor/symfony/var-dumper/Command/ServerDumpCommand.php index 13dd475b5..b64a884b9 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Command/ServerDumpCommand.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Command/ServerDumpCommand.php @@ -38,7 +38,7 @@ use Symfony\Component\VarDumper\Server\DumpServer; #[AsCommand(name: 'server:dump', description: 'Start a dump server that collects and displays dumps in a single place')] class ServerDumpCommand extends Command { - private $server; + private DumpServer $server; /** @var DumpDescriptorInterface[] */ private array $descriptors; @@ -54,7 +54,7 @@ class ServerDumpCommand extends Command parent::__construct(); } - protected function configure() + protected function configure(): void { $this ->addOption('format', null, InputOption::VALUE_REQUIRED, sprintf('The output format (%s)', implode(', ', $this->getAvailableFormats())), 'cli') diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/AbstractDumper.php b/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/AbstractDumper.php index 6ac380836..53165ba64 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/AbstractDumper.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/AbstractDumper.php @@ -26,12 +26,15 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface public const DUMP_COMMA_SEPARATOR = 4; public const DUMP_TRAILING_COMMA = 8; + /** @var callable|resource|string|null */ public static $defaultOutput = 'php://output'; protected $line = ''; + /** @var callable|null */ protected $lineDumper; + /** @var resource|null */ protected $outputStream; - protected $decimalPoint; // This is locale dependent + protected $decimalPoint = '.'; protected $indentPad = ' '; protected $flags; @@ -42,12 +45,10 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface * @param string|null $charset The default character encoding to use for non-UTF8 strings * @param int $flags A bit field of static::DUMP_* constants to fine tune dumps representation */ - public function __construct($output = null, string $charset = null, int $flags = 0) + public function __construct($output = null, ?string $charset = null, int $flags = 0) { $this->flags = $flags; - $this->setCharset($charset ?: ini_get('php.output_encoding') ?: ini_get('default_charset') ?: 'UTF-8'); - $this->decimalPoint = localeconv(); - $this->decimalPoint = $this->decimalPoint['decimal_point']; + $this->setCharset($charset ?: \ini_get('php.output_encoding') ?: \ini_get('default_charset') ?: 'UTF-8'); $this->setOutput($output ?: static::$defaultOutput); if (!$output && \is_string(static::$defaultOutput)) { static::$defaultOutput = $this->outputStream; @@ -57,9 +58,9 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface /** * Sets the output destination of the dumps. * - * @param callable|resource|string $output A line dumper callable, an opened stream or an output path + * @param callable|resource|string|null $output A line dumper callable, an opened stream or an output path * - * @return callable|resource|string The previous output destination + * @return callable|resource|string|null The previous output destination */ public function setOutput($output) { @@ -73,7 +74,7 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface $output = fopen($output, 'w'); } $this->outputStream = $output; - $this->lineDumper = [$this, 'echoLine']; + $this->lineDumper = $this->echoLine(...); } return $prev; @@ -120,9 +121,6 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface */ public function dump(Data $data, $output = null): ?string { - $this->decimalPoint = localeconv(); - $this->decimalPoint = $this->decimalPoint['decimal_point']; - if ($locale = $this->flags & (self::DUMP_COMMA_SEPARATOR | self::DUMP_TRAILING_COMMA) ? setlocale(\LC_NUMERIC, 0) : null) { setlocale(\LC_NUMERIC, 'C'); } @@ -160,6 +158,8 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface * * @param int $depth The recursive depth in the dumped structure for the line being dumped, * or -1 to signal the end-of-dump to the line dumper callable + * + * @return void */ protected function dumpLine(int $depth) { @@ -169,6 +169,8 @@ abstract class AbstractDumper implements DataDumperInterface, DumperInterface /** * Generic line dumper callback. + * + * @return void */ protected function echoLine(string $line, int $depth, string $indentPad) { diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/CliDumper.php b/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/CliDumper.php index f6e290ca4..af9637072 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/CliDumper.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/CliDumper.php @@ -22,6 +22,7 @@ use Symfony\Component\VarDumper\Cloner\Stub; class CliDumper extends AbstractDumper { public static $defaultColors; + /** @var callable|resource|string|null */ public static $defaultOutput = 'php://stdout'; protected $colors; @@ -51,6 +52,7 @@ class CliDumper extends AbstractDumper "\r" => '\r', "\033" => '\e', ]; + protected static $unicodeCharsRx = "/[\u{00A0}\u{00AD}\u{034F}\u{061C}\u{115F}\u{1160}\u{17B4}\u{17B5}\u{180E}\u{2000}-\u{200F}\u{202F}\u{205F}\u{2060}-\u{2064}\u{206A}-\u{206F}\u{3000}\u{2800}\u{3164}\u{FEFF}\u{FFA0}\u{1D159}\u{1D173}-\u{1D17A}]/u"; protected $collapseNextHash = false; protected $expandNextHash = false; @@ -61,10 +63,7 @@ class CliDumper extends AbstractDumper private bool $handlesHrefGracefully; - /** - * {@inheritdoc} - */ - public function __construct($output = null, string $charset = null, int $flags = 0) + public function __construct($output = null, ?string $charset = null, int $flags = 0) { parent::__construct($output, $charset, $flags); @@ -83,11 +82,13 @@ class CliDumper extends AbstractDumper ]); } - $this->displayOptions['fileLinkFormat'] = ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format') ?: 'file://%f#L%l'; + $this->displayOptions['fileLinkFormat'] = \ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format') ?: 'file://%f#L%l'; } /** * Enables/disables colored output. + * + * @return void */ public function setColors(bool $colors) { @@ -96,6 +97,8 @@ class CliDumper extends AbstractDumper /** * Sets the maximum number of characters per line for dumped strings. + * + * @return void */ public function setMaxStringWidth(int $maxStringWidth) { @@ -106,6 +109,8 @@ class CliDumper extends AbstractDumper * Configures styles. * * @param array $styles A map of style names to style definitions + * + * @return void */ public function setStyles(array $styles) { @@ -116,6 +121,8 @@ class CliDumper extends AbstractDumper * Configures display options. * * @param array $displayOptions A map of display options to customize the behavior + * + * @return void */ public function setDisplayOptions(array $displayOptions) { @@ -123,11 +130,12 @@ class CliDumper extends AbstractDumper } /** - * {@inheritdoc} + * @return void */ public function dumpScalar(Cursor $cursor, string $type, string|int|float|bool|null $value) { $this->dumpKey($cursor); + $this->collapseNextHash = $this->expandNextHash = false; $style = 'const'; $attr = $cursor->attr; @@ -137,6 +145,11 @@ class CliDumper extends AbstractDumper $style = 'default'; break; + case 'label': + $this->styles += ['label' => $this->styles['default']]; + $style = 'label'; + break; + case 'integer': $style = 'num'; @@ -153,17 +166,12 @@ class CliDumper extends AbstractDumper $style = 'float'; } - switch (true) { - case \INF === $value: $value = 'INF'; break; - case -\INF === $value: $value = '-INF'; break; - case is_nan($value): $value = 'NAN'; break; - default: - $value = (string) $value; - if (!str_contains($value, $this->decimalPoint)) { - $value .= $this->decimalPoint.'0'; - } - break; - } + $value = match (true) { + \INF === $value => 'INF', + -\INF === $value => '-INF', + is_nan($value) => 'NAN', + default => !str_contains($value = (string) $value, $this->decimalPoint) ? $value .= $this->decimalPoint.'0' : $value, + }; break; case 'NULL': @@ -186,11 +194,12 @@ class CliDumper extends AbstractDumper } /** - * {@inheritdoc} + * @return void */ public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut) { $this->dumpKey($cursor); + $this->collapseNextHash = $this->expandNextHash = false; $attr = $cursor->attr; if ($bin) { @@ -198,13 +207,16 @@ class CliDumper extends AbstractDumper } if ('' === $str) { $this->line .= '""'; + if ($cut) { + $this->line .= '…'.$cut; + } $this->endValue($cursor); } else { $attr += [ 'length' => 0 <= $cut ? mb_strlen($str, 'UTF-8') + $cut : 0, 'binary' => $bin, ]; - $str = $bin && false !== strpos($str, "\0") ? [$str] : explode("\n", $str); + $str = $bin && str_contains($str, "\0") ? [$str] : explode("\n", $str); if (isset($str[1]) && !isset($str[2]) && !isset($str[1][0])) { unset($str[1]); $str[0] .= "\n"; @@ -274,15 +286,14 @@ class CliDumper extends AbstractDumper } /** - * {@inheritdoc} + * @return void */ public function enterHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild) { - if (null === $this->colors) { - $this->colors = $this->supportsColors(); - } + $this->colors ??= $this->supportsColors(); $this->dumpKey($cursor); + $this->expandNextHash = false; $attr = $cursor->attr; if ($this->collapseNextHash) { @@ -315,7 +326,7 @@ class CliDumper extends AbstractDumper } /** - * {@inheritdoc} + * @return void */ public function leaveHash(Cursor $cursor, int $type, string|int|null $class, bool $hasChild, int $cut) { @@ -332,6 +343,8 @@ class CliDumper extends AbstractDumper * * @param bool $hasChild When the dump of the hash has child item * @param int $cut The number of items the hash has been cut by + * + * @return void */ protected function dumpEllipsis(Cursor $cursor, bool $hasChild, int $cut) { @@ -348,6 +361,8 @@ class CliDumper extends AbstractDumper /** * Dumps a key in a hash structure. + * + * @return void */ protected function dumpKey(Cursor $cursor) { @@ -437,12 +452,11 @@ class CliDumper extends AbstractDumper */ protected function style(string $style, string $value, array $attr = []): string { - if (null === $this->colors) { - $this->colors = $this->supportsColors(); - } + $this->colors ??= $this->supportsColors(); $this->handlesHrefGracefully ??= 'JetBrains-JediTerm' !== getenv('TERMINAL_EMULATOR') - && (!getenv('KONSOLE_VERSION') || (int) getenv('KONSOLE_VERSION') > 201100); + && (!getenv('KONSOLE_VERSION') || (int) getenv('KONSOLE_VERSION') > 201100) + && !isset($_SERVER['IDEA_INITIAL_DIRECTORY']); if (isset($attr['ellipsis'], $attr['ellipsis-type'])) { $prefix = substr($value, 0, -$attr['ellipsis']); @@ -474,7 +488,15 @@ class CliDumper extends AbstractDumper return $s.$endCchr; }, $value, -1, $cchrCount); - if ($this->colors) { + if (!($attr['binary'] ?? false)) { + $value = preg_replace_callback(static::$unicodeCharsRx, function ($c) use (&$cchrCount, $startCchr, $endCchr) { + ++$cchrCount; + + return $startCchr.'\u{'.strtoupper(dechex(mb_ord($c[0]))).'}'.$endCchr; + }, $value); + } + + if ($this->colors && '' !== $value) { if ($cchrCount && "\033" === $value[0]) { $value = substr($value, \strlen($startCchr)); } else { @@ -497,10 +519,15 @@ class CliDumper extends AbstractDumper } } if (isset($attr['href'])) { + if ('label' === $style) { + $value .= '^'; + } $value = "\033]8;;{$attr['href']}\033\\{$value}\033]8;;\033\\"; } - } elseif ($attr['if_links'] ?? false) { - return ''; + } + + if ('label' === $style && '' !== $value) { + $value .= ' '; } return $value; @@ -511,7 +538,7 @@ class CliDumper extends AbstractDumper if ($this->outputStream !== static::$defaultOutput) { return $this->hasColorSupport($this->outputStream); } - if (null !== static::$defaultColors) { + if (isset(static::$defaultColors)) { return static::$defaultColors; } if (isset($_SERVER['argv'][1])) { @@ -546,16 +573,23 @@ class CliDumper extends AbstractDumper } /** - * {@inheritdoc} + * @return void */ protected function dumpLine(int $depth, bool $endOfValue = false) { + if (null === $this->colors) { + $this->colors = $this->supportsColors(); + } + if ($this->colors) { $this->line = sprintf("\033[%sm%s\033[m", $this->styles['default'], $this->line); } parent::dumpLine($depth); } + /** + * @return void + */ protected function endValue(Cursor $cursor) { if (-1 === $cursor->hashType) { @@ -632,7 +666,7 @@ class CliDumper extends AbstractDumper return $result; } - private function getSourceLink(string $file, int $line) + private function getSourceLink(string $file, int $line): string|false { if ($fmt = $this->displayOptions['fileLinkFormat']) { return \is_string($fmt) ? strtr($fmt, ['%f' => $file, '%l' => $line]) : ($fmt->format($file, $line) ?: 'file://'.$file.'#L'.$line); diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/ContextProvider/RequestContextProvider.php b/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/ContextProvider/RequestContextProvider.php index 3684a4753..69dff067b 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/ContextProvider/RequestContextProvider.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/ContextProvider/RequestContextProvider.php @@ -22,8 +22,8 @@ use Symfony\Component\VarDumper\Cloner\VarCloner; */ final class RequestContextProvider implements ContextProviderInterface { - private $requestStack; - private $cloner; + private RequestStack $requestStack; + private VarCloner $cloner; public function __construct(RequestStack $requestStack) { diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/ContextProvider/SourceContextProvider.php b/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/ContextProvider/SourceContextProvider.php index 8ef6e360e..cadddfac4 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/ContextProvider/SourceContextProvider.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/ContextProvider/SourceContextProvider.php @@ -11,7 +11,8 @@ namespace Symfony\Component\VarDumper\Dumper\ContextProvider; -use Symfony\Component\HttpKernel\Debug\FileLinkFormatter; +use Symfony\Component\ErrorHandler\ErrorRenderer\FileLinkFormatter; +use Symfony\Component\HttpKernel\Debug\FileLinkFormatter as LegacyFileLinkFormatter; use Symfony\Component\VarDumper\Cloner\VarCloner; use Symfony\Component\VarDumper\Dumper\HtmlDumper; use Symfony\Component\VarDumper\VarDumper; @@ -28,9 +29,9 @@ final class SourceContextProvider implements ContextProviderInterface private int $limit; private ?string $charset; private ?string $projectDir; - private $fileLinkFormatter; + private FileLinkFormatter|LegacyFileLinkFormatter|null $fileLinkFormatter; - public function __construct(string $charset = null, string $projectDir = null, FileLinkFormatter $fileLinkFormatter = null, int $limit = 9) + public function __construct(?string $charset = null, ?string $projectDir = null, FileLinkFormatter|LegacyFileLinkFormatter|null $fileLinkFormatter = null, int $limit = 9) { $this->charset = $charset; $this->projectDir = $projectDir; @@ -44,7 +45,7 @@ final class SourceContextProvider implements ContextProviderInterface $file = $trace[1]['file']; $line = $trace[1]['line']; - $name = false; + $name = '-' === $file || 'Standard input code' === $file ? 'Standard input code' : false; $fileExcerpt = false; for ($i = 2; $i < $this->limit; ++$i) { diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/ContextualizedDumper.php b/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/ContextualizedDumper.php index 18ab56ebd..84cfb4259 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/ContextualizedDumper.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/ContextualizedDumper.php @@ -19,7 +19,7 @@ use Symfony\Component\VarDumper\Dumper\ContextProvider\ContextProviderInterface; */ class ContextualizedDumper implements DataDumperInterface { - private $wrappedDumper; + private DataDumperInterface $wrappedDumper; private array $contextProviders; /** @@ -31,13 +31,16 @@ class ContextualizedDumper implements DataDumperInterface $this->contextProviders = $contextProviders; } + /** + * @return string|null + */ public function dump(Data $data) { - $context = []; + $context = $data->getContext(); foreach ($this->contextProviders as $contextProvider) { - $context[\get_class($contextProvider)] = $contextProvider->getContext(); + $context[$contextProvider::class] = $contextProvider->getContext(); } - $this->wrappedDumper->dump($data->withContext($context)); + return $this->wrappedDumper->dump($data->withContext($context)); } } diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/DataDumperInterface.php b/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/DataDumperInterface.php index b173bccf3..df05b6af5 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/DataDumperInterface.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/DataDumperInterface.php @@ -20,5 +20,8 @@ use Symfony\Component\VarDumper\Cloner\Data; */ interface DataDumperInterface { + /** + * @return string|null + */ public function dump(Data $data); } diff --git a/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/HtmlDumper.php b/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/HtmlDumper.php index 40e97a534..ea09e6819 100644 --- a/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/HtmlDumper.php +++ b/data/web/inc/lib/vendor/symfony/var-dumper/Dumper/HtmlDumper.php @@ -21,6 +21,7 @@ use Symfony\Component\VarDumper\Cloner\Data; */ class HtmlDumper extends CliDumper { + /** @var callable|resource|string|null */ public static $defaultOutput = 'php://output'; protected static $themes = [ @@ -74,19 +75,16 @@ class HtmlDumper extends CliDumper ]; private array $extraDisplayOptions = []; - /** - * {@inheritdoc} - */ - public function __construct($output = null, string $charset = null, int $flags = 0) + public function __construct($output = null, ?string $charset = null, int $flags = 0) { AbstractDumper::__construct($output, $charset, $flags); $this->dumpId = 'sf-dump-'.mt_rand(); - $this->displayOptions['fileLinkFormat'] = ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); + $this->displayOptions['fileLinkFormat'] = \ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); $this->styles = static::$themes['dark'] ?? self::$themes['dark']; } /** - * {@inheritdoc} + * @return void */ public function setStyles(array $styles) { @@ -94,6 +92,9 @@ class HtmlDumper extends CliDumper $this->styles = $styles + $this->styles; } + /** + * @return void + */ public function setTheme(string $themeName) { if (!isset(static::$themes[$themeName])) { @@ -107,6 +108,8 @@ class HtmlDumper extends CliDumper * Configures display options. * * @param array $displayOptions A map of display options to customize the behavior + * + * @return void */ public function setDisplayOptions(array $displayOptions) { @@ -116,6 +119,8 @@ class HtmlDumper extends CliDumper /** * Sets an HTML header that will be dumped once in the output stream. + * + * @return void */ public function setDumpHeader(?string $header) { @@ -124,6 +129,8 @@ class HtmlDumper extends CliDumper /** * Sets an HTML prefix and suffix that will encapse every single dump. + * + * @return void */ public function setDumpBoundaries(string $prefix, string $suffix) { @@ -131,9 +138,6 @@ class HtmlDumper extends CliDumper $this->dumpSuffix = $suffix; } - /** - * {@inheritdoc} - */ public function dump(Data $data, $output = null, array $extraDisplayOptions = []): ?string { $this->extraDisplayOptions = $extraDisplayOptions; @@ -145,6 +149,8 @@ class HtmlDumper extends CliDumper /** * Dumps the HTML header. + * + * @return string */ protected function getDumpHeader() { @@ -158,19 +164,15 @@ class HtmlDumper extends CliDumper