Added FileNotFoundException

This commit is contained in:
Zi Xing 2022-04-16 18:07:58 -04:00
parent 954cf0fd11
commit 91eb808664
6 changed files with 31 additions and 1 deletions

View file

@ -2,6 +2,7 @@
namespace ncc\Abstracts; namespace ncc\Abstracts;
use ncc\Exceptions\FileNotFoundException;
use ncc\Exceptions\InvalidProjectConfigurationException; use ncc\Exceptions\InvalidProjectConfigurationException;
abstract class ExceptionCodes abstract class ExceptionCodes
@ -10,4 +11,9 @@
* @see InvalidProjectConfigurationException * @see InvalidProjectConfigurationException
*/ */
const InvalidProjectConfigurationException = -1700; const InvalidProjectConfigurationException = -1700;
/**
* @see FileNotFoundException;
*/
const FileNotFoundException = -1701;
} }

View file

@ -0,0 +1,20 @@
<?php
namespace ncc\Exceptions;
use Exception;
use ncc\Abstracts\ExceptionCodes;
use Throwable;
class FileNotFoundException extends Exception
{
/**
* @param string $path
* @param Throwable|null $previous
*/
public function __construct(string $path = "", ?Throwable $previous = null)
{
parent::__construct('The file \'' . realpath($path) . '\' was not found', ExceptionCodes::FileNotFoundException, $previous);
$this->code = ExceptionCodes::FileNotFoundException;
}
}

View file

@ -81,7 +81,9 @@
{ {
$ProjectConfigurationObject = new ProjectConfiguration(); $ProjectConfigurationObject = new ProjectConfiguration();
$ProjectConfigurationObject->Assembly = Assembly::fromArray((Functions::array_bc($data, 'assembly') ?? [])); $ProjectConfigurationObject->Project = Functions::array_bc($data, 'project');
$ProjectConfigurationObject->Assembly = Functions::array_bc($data, 'assembly');
$ProjectConfigurationObject->Build = Functions::array_bc($data, 'build');
return $ProjectConfigurationObject; return $ProjectConfigurationObject;
} }

1
tests/autoload.php Normal file
View file

@ -0,0 +1 @@
<?php

View file

@ -0,0 +1 @@
<?php