MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: //home/cafsindia/snap.cafsinfotech.in/vendor/czproject/git-php/src/CommitId.php
<?php

	namespace CzProject\GitPhp;


	class CommitId
	{
		/** @var string */
		private $id;


		/**
		 * @param string $id
		 */
		public function __construct($id)
		{
			if (!self::isValid($id)) {
				throw new InvalidArgumentException("Invalid commit ID" . (is_string($id) ? " '$id'." : ', expected string, ' . gettype($id) . ' given.'));
			}

			$this->id = $id;
		}


		/**
		 * @return string
		 */
		public function toString()
		{
			return $this->id;
		}


		/**
		 * @return string
		 */
		public function __toString()
		{
			return $this->id;
		}


		/**
		 * @param  string $id
		 * @return bool
		 */
		public static function isValid($id)
		{
			return is_string($id) && preg_match('/^[0-9a-f]{40}$/i', $id);
		}
	}