GitHub
Tests: 12 • Commercial: 2 • Pet projects: 4 • Legacy: 4
Total: 22

.NET Framework

Test
2021

Project Request

ASP.NET MVC • C# • SQL Server
Idea of the project: if someone wants to order a project development, here you can send an application.
Test
2020

ProjectC

ASP.NET MVC • C# • JSON • jQuery
JSON data processing.
Test
2020

Vehicle Maintenance

ASP.NET MVC • VB.NET • JSON
Idea of the project: if someone wants to order a project development, here you can send an application.
Test
2019

Movie Navigator

ASP.NET MVC • VB.NET
Request information about movie from IMDB.
Test
2018

Customers Exchange

ASP.NET MVC • C# • SQL Server
Automated teller machine emulation.
Test
2016

ATM

ASP.NET MVC • C#
Automated teller machine emulation.

.NET Core

Pet project
2022

Mail Daemon

.NET 9 • Console • JSON
Utility to send mails with customizable settings.

Custom

Code
2024

Buns of code

.NET Framework • C# • JavaScript
Code snippets from my projects, ready to use; tiny tests; code examples.

PHP

Test
2024

Mediabox

PHP 8 • Laravel 11 • Vue.js • Composer • SQLite
Test project for media files management.
Test
2020

Loan Castle

PHP • MariaDB
Jums jāizstrādā kāda lielāk projekta prototips. Izstrādājot prototipu, paturiet prātā, ka projektam attīstoties, šo prototipu varētu vajadzēt pilnveidot.
Test
2020

Content Management

PHP • MySQL • AJAX
Создать простой сайт, где будет страница с формой для авторизации и страница для авторизованного пользователя.
Test
2019

Laravel

PHP • Laravel • Vue.js • Composer • SQLite
Izveidot aplikāciju, kura ik pēc noteikta intervāla (60 sekundes) veic ierakstu datubāzē izmantojot Laravel freimworka iebūvēto funkcionalitāti.
Test
2019

Phone Check

PHP • JavaScript • JSON • Docker
Implement application to detect country by phone number.

Frontend

Test
2021

Forex Wall

npm • React
For this exercise, what we need is a simple live wall for tracking currencies.

Business projects

Commercial
2008

Certification Center

.NET Framework 4.8 • ASP.NET Web Forms • C# • LINQ • SQL Server • ADO.NET • Dapper • JavaScript • jQuery • Git
Transport registration and certification services in Latvia, Customer Relationship Management.
Commercial
2000

Amerikas Auto

.NET Framework 4.8 • ASP.NET Web Forms • C# • LINQ • SQL Server • ADO.NET • Entity Framework • JavaScript • jQuery • Git
Car service and spare parts for all USA and European car models, Customer Relationship Management.

Pet projects

Pet project
2023

Geolocation Assistant

.NET 8 • ASP.NET Core • C# • Web API • JSON • Git
Website for determining geolocation by IP or geotagged photo.
Pet project
2008

Web Dynamics

.NET Framework 4.8 • ASP.NET Web Forms • C# • LINQ • Web API • JSON • SQL Server • Dapper • JavaScript • jQuery • SVG • Git
Software development blog. Articles, books, videos, content management.
Pet project
2000

Blackball

.NET Framework 4.8 • ASP.NET Web Forms • C# • LINQ • Web API • JSON • XML • SQL Server • Dapper • JavaScript • jQuery • SVG • Git
My entertainment portal created from scratch.

Good old times

Legacy
2000

DOS Clock

Turbo Pascal • Assembler
Digital clock.
Legacy
2000

BrainOut

Turbo Pascal • Assembler
Tank battle game.
Legacy
1999

Airport Administrator

Turbo Pascal
Курсовая работа в институте.
Legacy
1998

Atomizer

Turbo Pascal • Assembler
Atomizer, aka «Studio2D». Graphic raster editor. AGI is my own «Atomizer Generated Image» file format.

Laravel

2019 Test

Izveidot aplikāciju, kura ik pēc noteikta intervāla (60 sekundes) veic ierakstu datubāzē izmantojot Laravel freimworka iebūvēto funkcionalitāti.

PHP Laravel Vue.js Composer SQLite
Information
Source code
  app
  Http
  Auth
  css
  js
  js
  lang
  en
  sass
  app
  data
  logs
  Unit
  src
  src
  lib
  docs
  en
  src
  docs
  en
  lib
  src
  Cron
  Cron
  src
  filp
  src
  css
  js
  Util
  src
  ORM
  Spot
  test
  Core
  Text
  Type
  Xml
  Core
  Text
  Type
  Xml
  html
  src
  src
  src
  Auth
  make
  auth
  Bus
  Auth
  Bus
  Http
  Mail
  View
  Auth
  Bus
  Http
  Http
  Json
  Log
  Mail
  html
  text
  Jobs
  View
  src
  src
  Util
  docs
  Pass
  Pass
  Pass
  doc
  src
  Curl
  doc
  f001
  f002
  f003
  f004
  f005
  f006
  f007
  f008
  src
  Date
  Spl
  src
  Lang
  List
  doc
  lib
  Node
  Expr
  Cast
  Name
  Stmt
  test
  code
  expr
  uvs
  stmt
  loop
  expr
  stmt
  Node
  Stmt
  src
  opis
  src
  dist
  lib
  src
  xml
  xml
  src
  Unit
  src
  src
  Tags
  src
  src
  src
  Call
  Node
  Call
  Util
  src
  Node
  Html
  css
  js
  Xml
  HTML
  XML
  src
  src
  src
  src
  src
  Stub
  Hook
  Util
  Log
  PHP
  cli
  1149
  1216
  1265
  1330
  1335
  1337
  1348
  1351
  1374
  1437
  1468
  1471
  1472
  1570
  2085
  2137
  2145
  2158
  2366
  2380
  2382
  2435
  244
  2448
  2724
  2725
  2731
  2811
  2830
  2972
  3093
  3107
  3156
  322
  3364
  3379
  3380
  3396
  433
  445
  498
  503
  581
  74
  765
  797
  873
  Trac
  1021
  523
  578
  684
  783
  fail
  unit
  Util
  PHP
  psr
  src
  log
  Psr
  Log
  Test
  src
  psy
  src
  Sudo
  Util
  test
  Sudo
  Util
  box
  uuid
  src
  Time
  Node
  Time
  src
  src
  diff
  src
  out
  src
  src
  src
  src
  src
  src
  src
  src
  doc
  lib
  Mime
  Pop
  Auth
  Mime
  bug
  unit
  Mime
  Auth
  dkim
  Node
  Node
  psr4
  phpt
  .dot
  b
  a
  A
  B
  C
  copy
  A
  B
  C
  one
  b
  .dot
  a
  dir
  File
  Test
  File
  test
  Test
  Log
  Log
  mime
  Part
  test
  Part
  glob
  Test
  data
  dat
  res
  Util
  Util
  Test
  css
  js
  Test
  Test
  src
  src
  Css
  Rule
  src
  src
  .env
  null
Root / vendor / nesbot / carbon / src / Carbon / Traits / Creator.php
<?php /** * This file is part of the Carbon package. * * (c) Brian Nesbitt <brian@nesbot.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Carbon\Traits; use Carbon\Carbon; use Carbon\CarbonImmutable; use Carbon\CarbonInterface; use Carbon\CarbonTimeZone; use Carbon\Exceptions\InvalidDateException; use Carbon\Translator; use DateTimeInterface; use Exception; use InvalidArgumentException; /** * Trait Creator. * * Static creators. * * Depends on the following methods: * * @method static Carbon|CarbonImmutable getTestNow() */ trait Creator { /** * The errors that can occur. * * @var array */ protected static $lastErrors; /** * Create a new Carbon instance. * * Please see the testing aids section (specifically static::setTestNow()) * for more on the possibility of this constructor returning a test instance. * * @param string|null $time * @param \DateTimeZone|string|null $tz */ public function __construct($time = null, $tz = null) { if (is_int($time)) { $time = "@$time"; } $originalTz = $tz; // If the class has a test now set and we are trying to create a now() // instance then override as required $isNow = empty($time) || $time === 'now'; if (method_exists(static::class, 'hasTestNow') && method_exists(static::class, 'getTestNow') && static::hasTestNow() && ($isNow || static::hasRelativeKeywords($time)) ) { static::mockConstructorParameters($time, $tz); } /** @var CarbonTimeZone $timezone */ $timezone = $this->autoDetectTimeZone($tz, $originalTz); // Work-around for PHP bug https://bugs.php.net/bug.php?id=67127 if (strpos((string) .1, '.') === false) { $locale = setlocale(LC_NUMERIC, '0'); setlocale(LC_NUMERIC, 'C'); } parent::__construct($time ?: 'now', $timezone); if (isset($locale)) { setlocale(LC_NUMERIC, $locale); } static::setLastErrors(parent::getLastErrors()); } /** * Create a Carbon instance from a DateTime one. * * @param \DateTimeInterface $date * * @return static */ public static function instance($date) { if ($date instanceof static) { return clone $date; } static::expectDateTime($date); $instance = new static($date->format('Y-m-d H:i:s.u'), $date->getTimezone()); if ($date instanceof CarbonInterface || $date instanceof Options) { $instance->settings($date->getSettings()); } return $instance; } /** * 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 * than (new Carbon('Monday next week'))->fn(). * * @param string|null $time * @param \DateTimeZone|string|null $tz * * @return static */ public static function rawParse($time = null, $tz = null) { if ($time instanceof DateTimeInterface) { return static::instance($time); } try { return new static($time, $tz); } catch (Exception $exception) { try { return static::now($tz)->change($time); } catch (Exception $ignored) { throw $exception; } } } /** * 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 * than (new Carbon('Monday next week'))->fn(). * * @param string|null $time * @param \DateTimeZone|string|null $tz * * @return static */ public static function parse($time = null, $tz = null) { $function = static::$parseFunction; if (!$function) { return static::rawParse($time, $tz); } if (is_string($function) && method_exists(static::class, $function)) { $function = [static::class, $function]; } return $function(...func_get_args()); } /** * Create a carbon instance from a localized string (in French, Japanese, Arabic, etc.). * * @param string $time * @param string $locale * @param \DateTimeZone|string|null $tz * * @return static */ public static function parseFromLocale($time, $locale, $tz = null) { return static::rawParse(static::translateTimeString($time, $locale, 'en'), $tz); } /** * Get a Carbon instance for the current date and time. * * @param \DateTimeZone|string|null $tz * * @return static */ public static function now($tz = null) { return new static(null, $tz); } /** * Create a Carbon instance for today. * * @param \DateTimeZone|string|null $tz * * @return static */ public static function today($tz = null) { return static::rawParse('today', $tz); } /** * Create a Carbon instance for tomorrow. * * @param \DateTimeZone|string|null $tz * * @return static */ public static function tomorrow($tz = null) { return static::rawParse('tomorrow', $tz); } /** * Create a Carbon instance for yesterday. * * @param \DateTimeZone|string|null $tz * * @return static */ public static function yesterday($tz = null) { return static::rawParse('yesterday', $tz); } /** * Create a Carbon instance for the greatest supported date. * * @return static */ public static function maxValue() { if (self::$PHPIntSize === 4) { // 32 bit return static::createFromTimestamp(PHP_INT_MAX); // @codeCoverageIgnore } // 64 bit return static::create(9999, 12, 31, 23, 59, 59); } /** * Create a Carbon instance for the lowest supported date. * * @return static */ public static function minValue() { if (self::$PHPIntSize === 4) { // 32 bit return static::createFromTimestamp(~PHP_INT_MAX); // @codeCoverageIgnore } // 64 bit return static::create(1, 1, 1, 0, 0, 0); } private static function assertBetween($unit, $value, $min, $max) { if (static::isStrictModeEnabled() && ($value < $min || $value > $max)) { throw new InvalidArgumentException("$unit must be between $min and $max, $value given"); } } /** * Create a new Carbon instance from a specific date and time. * * If any of $year, $month or $day are set to null their now() values will * be used. * * If $hour is null it will be set to its now() value and the default * values for $minute and $second will be their now() values. * * 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 * * @throws \InvalidArgumentException * * @return static */ 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)) { return static::parse($year, $tz); } $defaults = null; $getDefault = function ($unit) use ($tz, &$defaults) { if ($defaults === null) { $now = static::hasTestNow() ? static::getTestNow() : static::now($tz); $defaults = array_combine([ 'year', 'month', 'day', 'hour', 'minute', 'second', ], explode('-', $now->rawFormat('Y-n-j-G-i-s.u'))); } return $defaults[$unit]; }; $year = $year === null ? $getDefault('year') : $year; $month = $month === null ? $getDefault('month') : $month; $day = $day === null ? $getDefault('day') : $day; $hour = $hour === null ? $getDefault('hour') : $hour; $minute = $minute === null ? $getDefault('minute') : $minute; $second = (float) ($second === null ? $getDefault('second') : $second); self::assertBetween('month', $month, 0, 99); self::assertBetween('day', $day, 0, 99); self::assertBetween('hour', $hour, 0, 99); self::assertBetween('minute', $minute, 0, 99); self::assertBetween('second', $second, 0, 99); $fixYear = null; if ($year < 0) { $fixYear = $year; $year = 0; } elseif ($year > 9999) { $fixYear = $year - 9999; $year = 9999; } $second = ($second < 10 ? '0' : '').number_format($second, 6); /** @var CarbonImmutable|Carbon $instance */ $instance = static::rawCreateFromFormat('!Y-n-j G:i:s.u', sprintf('%s-%s-%s %s:%02s:%02s', $year, $month, $day, $hour, $minute, $second), $tz); if ($fixYear !== null) { $instance = $instance->addYears($fixYear); } return $instance; } /** * Create a new safe Carbon instance from a specific date and time. * * If any of $year, $month or $day are set to null their now() values will * be used. * * If $hour is null it will be set to its now() value and the default * values for $minute and $second will be their now() values. * * If $hour is not null then the default values for $minute and $second * will be 0. * * If one of the set values is not valid, an \InvalidArgumentException * will be thrown. * * @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 * * @throws \Carbon\Exceptions\InvalidDateException|\InvalidArgumentException * * @return static|false */ public static function createSafe($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $tz = null) { $fields = static::getRangesByUnit(); foreach ($fields as $field => $range) { if ($$field !== null && (!is_int($$field) || $$field < $range[0] || $$field > $range[1])) { if (static::isStrictModeEnabled()) { throw new InvalidDateException($field, $$field); } return false; } } $instance = static::create($year, $month, $day, $hour, $minute, $second, $tz); foreach (array_reverse($fields) as $field => $range) { if ($$field !== null && (!is_int($$field) || $$field !== $instance->$field)) { if (static::isStrictModeEnabled()) { throw new InvalidDateException($field, $$field); } return false; } } return $instance; } /** * Create a Carbon instance from just a date. The time portion is set to now. * * @param int|null $year * @param int|null $month * @param int|null $day * @param \DateTimeZone|string|null $tz * * @throws \InvalidArgumentException * * @return static */ public static function createFromDate($year = null, $month = null, $day = null, $tz = null) { return static::create($year, $month, $day, null, null, null, $tz); } /** * Create a Carbon instance from just a date. The time portion is set to midnight. * * @param int|null $year * @param int|null $month * @param int|null $day * @param \DateTimeZone|string|null $tz * * @return static */ public static function createMidnightDate($year = null, $month = null, $day = null, $tz = null) { return static::create($year, $month, $day, 0, 0, 0, $tz); } /** * Create a Carbon instance from just a time. The date portion is set to today. * * @param int|null $hour * @param int|null $minute * @param int|null $second * @param \DateTimeZone|string|null $tz * * @throws \InvalidArgumentException * * @return static */ public static function createFromTime($hour = 0, $minute = 0, $second = 0, $tz = null) { return static::create(null, null, null, $hour, $minute, $second, $tz); } /** * Create a Carbon instance from a time string. The date portion is set to today. * * @param string $time * @param \DateTimeZone|string|null $tz * * @throws \InvalidArgumentException * * @return static */ public static function createFromTimeString($time, $tz = null) { return static::today($tz)->setTimeFromTimeString($time); } /** * @param string $format Datetime format * @param string $time * @param \DateTimeZone|string|false|null $originalTz * * @return \DateTimeInterface|false */ private static function createFromFormatAndTimezone($format, $time, $originalTz) { // Work-around for https://bugs.php.net/bug.php?id=75577 // @codeCoverageIgnoreStart if (version_compare(PHP_VERSION, '7.3.0-dev', '<')) { $format = str_replace('.v', '.u', $format); } // @codeCoverageIgnoreEnd if ($originalTz === null) { return parent::createFromFormat($format, "$time"); } $tz = is_int($originalTz) ? @timezone_name_from_abbr('', (int) ($originalTz * 3600), 1) : $originalTz; $tz = static::safeCreateDateTimeZone($tz, $originalTz); if ($tz === false) { return false; } return parent::createFromFormat($format, "$time", $tz); } /** * Create a Carbon instance from a specific format. * * @param string $format Datetime format * @param string $time * @param \DateTimeZone|string|false|null $tz * * @throws InvalidArgumentException * * @return static|false */ public static function rawCreateFromFormat($format, $time, $tz = null) { if (preg_match('/(?<!\\\\)(?:\\\\{2})*(a|A)/', $format, $aMatches, PREG_OFFSET_CAPTURE) && preg_match('/(?<!\\\\)(?:\\\\{2})*(h|g|H|G)/', $format, $hMatches, PREG_OFFSET_CAPTURE) && $aMatches[1][1] < $hMatches[1][1] && preg_match('/(am|pm|AM|PM)/', $time) ) { $format = preg_replace('/^(.*)(?<!\\\\)((?:\\\\{2})*)(a|A)(.*)$/U', '$1$2$4 $3', $format); $time = preg_replace('/^(.*)(am|pm|AM|PM)(.*)$/U', '$1$3 $2', $time); } // 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(); if (($mock = static::getTestNow()) && $date instanceof DateTimeInterface) { // Set timezone from mock if custom timezone was neither given directly nor as a part of format. // First let's skip the part that will be ignored by the parser. $nonEscaped = '(?<!\\\\)(\\\\{2})*'; $nonIgnored = preg_replace("/^.*{$nonEscaped}!/s", '', $format); if ($tz === null && !preg_match("/{$nonEscaped}[eOPT]/", $nonIgnored)) { $tz = $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); // Prepend mock datetime only if the format does not contain non escaped unix epoch reset flag. if (!preg_match("/{$nonEscaped}[!|]/", $format)) { $format = static::MOCK_DATETIME_FORMAT.' '.$format; $time = ($mock instanceof self ? $mock->rawFormat(static::MOCK_DATETIME_FORMAT) : $mock->format(static::MOCK_DATETIME_FORMAT)).' '.$time; } // Regenerate date from the modified format to base result on the mocked instance instead of now. $date = self::createFromFormatAndTimezone($format, $time, $tz); } if ($date instanceof DateTimeInterface) { $instance = static::instance($date); $instance::setLastErrors($lastErrors); return $instance; } if (static::isStrictModeEnabled()) { throw new InvalidArgumentException(implode(PHP_EOL, $lastErrors['errors'])); } return false; } /** * Create a Carbon instance from a specific format. * * @param string $format Datetime format * @param string $time * @param \DateTimeZone|string|false|null $tz * * @throws InvalidArgumentException * * @return static|false */ public static function createFromFormat($format, $time, $tz = null) { $function = static::$createFromFormatFunction; if (!$function) { return static::rawCreateFromFormat($format, $time, $tz); } if (is_string($function) && method_exists(static::class, $function)) { $function = [static::class, $function]; } return $function(...func_get_args()); } /** * Create a Carbon instance from a specific ISO format (same replacements as ->isoFormat()). * * @param string $format Datetime format * @param string $time * @param \DateTimeZone|string|false|null $tz optional timezone * @param string|null $locale locale to be used for LTS, LT, LL, LLL, etc. macro-formats (en by fault, unneeded if no such macro-format in use) * @param \Symfony\Component\Translation\TranslatorInterface $translator optional custom translator to use for macro-formats * * @throws InvalidArgumentException * * @return static|false */ public static function createFromIsoFormat($format, $time, $tz = null, $locale = 'en', $translator = null) { $format = preg_replace_callback('/(?<!\\\\)(\\\\{2})*(LTS|LT|[Ll]{1,4})/', function ($match) use ($locale, $translator) { [$code] = $match; static $formats = null; if ($formats === null) { $translator = $translator ?: Translator::get($locale); $formats = [ 'LT' => static::getTranslationMessageWith($translator, 'formats.LT', $locale, 'h:mm A'), 'LTS' => static::getTranslationMessageWith($translator, 'formats.LTS', $locale, 'h:mm:ss A'), 'L' => static::getTranslationMessageWith($translator, 'formats.L', $locale, 'MM/DD/YYYY'), 'LL' => static::getTranslationMessageWith($translator, 'formats.LL', $locale, 'MMMM D, YYYY'), 'LLL' => static::getTranslationMessageWith($translator, 'formats.LLL', $locale, 'MMMM D, YYYY h:mm A'), 'LLLL' => static::getTranslationMessageWith($translator, 'formats.LLLL', $locale, 'dddd, MMMM D, YYYY h:mm A'), ]; } return $formats[$code] ?? preg_replace_callback( '/MMMM|MM|DD|dddd/', function ($code) { return mb_substr($code[0], 1); }, $formats[strtoupper($code)] ?? '' ); }, $format); $format = preg_replace_callback('/(?<!\\\\)(\\\\{2})*('.CarbonInterface::ISO_FORMAT_REGEXP.'|[A-Za-z])/', function ($match) { [$code] = $match; static $replacements = null; if ($replacements === null) { $replacements = [ 'OD' => 'd', 'OM' => 'M', 'OY' => 'Y', 'OH' => 'G', 'Oh' => 'g', 'Om' => 'i', 'Os' => 's', 'D' => 'd', 'DD' => 'd', 'Do' => 'd', 'd' => '!', 'dd' => '!', 'ddd' => 'D', 'dddd' => 'D', 'DDD' => 'z', 'DDDD' => 'z', 'DDDo' => 'z', 'e' => '!', 'E' => '!', 'H' => 'G', 'HH' => 'H', 'h' => 'g', 'hh' => 'h', 'k' => 'G', 'kk' => 'G', 'hmm' => 'gi', 'hmmss' => 'gis', 'Hmm' => 'Gi', 'Hmmss' => 'Gis', 'm' => 'i', 'mm' => 'i', 'a' => 'a', 'A' => 'a', 's' => 's', 'ss' => 's', 'S' => '*', 'SS' => '*', 'SSS' => '*', 'SSSS' => '*', 'SSSSS' => '*', 'SSSSSS' => 'u', 'SSSSSSS' => 'u*', 'SSSSSSSS' => 'u*', 'SSSSSSSSS' => 'u*', 'M' => 'm', 'MM' => 'm', 'MMM' => 'M', 'MMMM' => 'M', 'Mo' => 'm', 'Q' => '!', 'Qo' => '!', 'G' => '!', 'GG' => '!', 'GGG' => '!', 'GGGG' => '!', 'GGGGG' => '!', 'g' => '!', 'gg' => '!', 'ggg' => '!', 'gggg' => '!', 'ggggg' => '!', 'W' => '!', 'WW' => '!', 'Wo' => '!', 'w' => '!', 'ww' => '!', 'wo' => '!', 'x' => 'U???', 'X' => 'U', 'Y' => 'Y', 'YY' => 'y', 'YYYY' => 'Y', 'YYYYY' => 'Y', 'YYYYYY' => 'Y', 'z' => 'e', 'zz' => 'e', 'Z' => 'e', 'ZZ' => 'e', ]; } $format = $replacements[$code] ?? '?'; if ($format === '!') { throw new InvalidArgumentException("Format $code not supported for creation."); } return $format; }, $format); return static::rawCreateFromFormat($format, $time, $tz); } /** * Create a Carbon instance from a specific format and a string in a given language. * * @param string $format Datetime format * @param string $locale * @param string $time * @param \DateTimeZone|string|false|null $tz * * @throws InvalidArgumentException * * @return static|false */ public static function createFromLocaleFormat($format, $locale, $time, $tz = null) { return static::rawCreateFromFormat($format, static::translateTimeString($time, $locale, 'en'), $tz); } /** * Create a Carbon instance from a specific ISO format and a string in a given language. * * @param string $format Datetime ISO format * @param string $locale * @param string $time * @param \DateTimeZone|string|false|null $tz * * @throws InvalidArgumentException * * @return static|false */ public static function createFromLocaleIsoFormat($format, $locale, $time, $tz = null) { $time = static::translateTimeString($time, $locale, 'en', CarbonInterface::TRANSLATE_MONTHS | CarbonInterface::TRANSLATE_DAYS | CarbonInterface::TRANSLATE_MERIDIEM); return static::createFromIsoFormat($format, $time, $tz, $locale); } /** * Make a Carbon instance from given variable if possible. * * Always return a new instance. Parse only strings and only these likely to be dates (skip intervals * and recurrences). Throw an exception for invalid format, but otherwise return null. * * @param mixed $var * * @return static|null */ public static function make($var) { if ($var instanceof DateTimeInterface) { return static::instance($var); } $date = null; if (is_string($var)) { $var = trim($var); $first = substr($var, 0, 1); if (is_string($var) && $first !== 'P' && $first !== 'R' && preg_match('/[a-z0-9]/i', $var)) { $date = static::parse($var); } } return $date; } /** * Set last errors. * * @param array $lastErrors * * @return void */ private static function setLastErrors(array $lastErrors) { static::$lastErrors = $lastErrors; } /** * {@inheritdoc} */ public static function getLastErrors() { return static::$lastErrors; } }