// Import SPL stuff
use \stdClass;
+use \InvalidArgumentException;
use \Iterator;
use \ReflectionClass;
use \SplFileInfo;
// Import framework stuff
use CoreFramework\Filesystem\FrameworkDirectory;
+use CoreFramework\Generic\NullPointerException;
use CoreFramework\Object\BaseFrameworkSystem;
// Import SPL stuff
* be verified here.
*
* @param $pathName The path name we shall pass to opendir()
- * @param $inConstructor If we are in de/con-structor or from somewhere else
* @return $pointerInstance A prepared instance of FrameworkDirectoryPointer
- * @throws PathIsEmptyException If the provided path name is empty
+ * @throws NullPointerException If the provided path name is null
* @throws InvalidPathStringException If the provided path name is not a string
* @throws PathIsNoDirectoryException If the provided path name is not valid
* @throws PathReadProtectedException If the provided path name is read-protected
- * @todo Get rid of inConstructor, could be old-lost code.
*/
- public static final function createFrameworkDirectoryPointer ($pathName, $inConstructor = false) {
+ public static final function createFrameworkDirectoryPointer ($pathName) {
// Some pre-sanity checks...
if (is_null($pathName)) {
// No pathname given
- if ($inConstructor) {
- return NULL;
- } else {
- throw new PathIsEmptyException(NULL, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- }
+ throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
} elseif (!is_string($pathName)) {
// Is not a string
- if ($inConstructor) {
- return NULL;
- } else {
- throw new InvalidPathStringException(NULL, self::EXCEPTION_INVALID_STRING);
- }
+ throw new InvalidPathStringException(NULL, self::EXCEPTION_INVALID_STRING);
} elseif (!is_dir($pathName)) {
// Not a directory
- if ($inConstructor) {
- return NULL;
- } else {
- throw new PathIsNoDirectoryException($pathName, self::EXCEPTION_INVALID_PATH_NAME);
- }
+ throw new PathIsNoDirectoryException($pathName, self::EXCEPTION_INVALID_PATH_NAME);
} elseif (!is_readable($pathName)) {
// Not readable
- if ($inConstructor) {
- return NULL;
- } else {
- throw new PathReadProtectedException($pathName, self::EXCEPTION_READ_PROTECED_PATH);
- }
+ throw new PathReadProtectedException($pathName, self::EXCEPTION_READ_PROTECED_PATH);
}
// Create new instance
* be verified here.
*
* @param $fileName The file name we shall pass to fopen()
- * @throws FileIsEmptyException If the provided file name is empty.
* @throws FileIoException If the file is not reachable
* @throws FileReadProtectedException If the file cannot be read from
* @return void
use CoreFramework\Generic\NullPointerException;
// Import SPL stuff
+use \InvalidArgumentException;
use \SplFileInfo;
/**
*
* @param $infoInstance An instance of a SplFileInfo class
* @param $mode The output mode ('w', 'a' are valid)
- * @throws FileIsEmptyException If the provided file name is empty.
+ * @throws InvalidArgumentException If parameter mode is empty
* @throws FileIoException If fopen() returns not a file resource
* @return void
*/
public static final function createFrameworkRawFileOutputPointer (SplFileInfo $infoInstance, $mode) {
// Some pre-sanity checks...
- if (is_null($infoInstance)) {
+ if (is_null($mode)) {
// No infoInstance given
- throw new FileIsEmptyException(NULL, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ throw new InvalidArgumentException('Parameter "mode" is empty');
} // END - if
// Try to open a handler
$fileObject = $infoInstance->openFile($mode);
if ((is_null($fileObject)) || ($fileObject === false)) {
// Something bad happend
- throw new FileIoException ($infoInstance, self::EXCEPTION_FILE_POINTER_INVALID);
+ throw new FileIoException($infoInstance, self::EXCEPTION_FILE_POINTER_INVALID);
} // END - if
// Create new instance
use CoreFramework\Generic\UnsupportedOperationException;
// Import SPL stuff
+use \InvalidArgumentException;
use \SplFileInfo;
/**
*
* @param $fileInstance An instance of a SplFileInfo class
* @param $mode The output mode ('w', 'a' are valid)
- * @throws FileIsEmptyException If the provided file name is empty.
+ * @throws InvalidArgumentException If mode is empty
* @throws FileIoException If fopen() returns not a file resource
* @return void
*/
public static final function createFrameworkTextFileOutputPointer (SplFileInfo $fileInstance, $mode) {
// Some pre-sanity checks...
- if (is_null($fileInstance)) {
+ if (empty($mode)) {
// No filename given
- throw new FileIsEmptyException(NULL, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ throw new InvalidArgumentException('Parameter "mode" is empty');
} // END - if
// Try to open a handler
$fileObject = $fileInstance->openFile($mode);
+
+ // Is it valid?
if ((is_null($fileObject)) || ($fileObject === false)) {
// Something bad happend
- throw new FileIoException ($fileName, self::EXCEPTION_FILE_POINTER_INVALID);
+ throw new FileIoException($fileInstance, self::EXCEPTION_FILE_POINTER_INVALID);
} // END - if
// Create new instance
use CoreFramework\Registry\Registerable;
use CoreFramework\Registry\Registry;
+// Import SPL stuff
+use \InvalidArgumentException;
+
/**
* The language sub-system for handling language strings being used in the
* application and whole framework
*
* @param $languageBasePath The local base path for all language strings or emty for auto-detection
* @return $langInstance An instance of LanguageSystem
- * @throws LanguagePathIsEmptyException If the provided $languageBasePath is empty
+ * @throws InvalidArgumentException If languageBasePath remains empty (@TODO Get rid of that old-lost code)
* @throws InvalidLanguagePathStringException If $languageBasePath is no string
* @throws LanguagePathIsNoDirectoryException If $languageBasePath is no
* directory or not found
// Is the base path valid?
if (empty($languageBasePath)) {
// Language path is empty
- throw new LanguagePathIsEmptyException($langInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ throw new InvalidArgumentException('languageBasePath is still empty');
} elseif (!is_string($languageBasePath)) {
// Is not a string
throw new InvalidLanguagePathStringException(array($langInstance, $languageBasePath), self::EXCEPTION_INVALID_STRING);
<?php
-// Own namespace
-namespace CoreFramework\Configuration;
-
-// Import framework stuff
-use CoreFramework\Generic\FrameworkException;
-
-/**
- * An exception thrown when a configuration entry is empty
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class ConfigEntryIsEmptyException extends FrameworkException {
- /**
- * The constructor
- *
- * @param $class Class throwing this exception
- * @param $code Code number for the exception
- * @return void
- */
- public function __construct (FrameworkConfiguration $class, $code) {
- // Add a message around the missing class
- $message = sprintf('[%s:%d] Empty configuration entry provided.',
- $class->__toString(),
- $this->getLine()
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-
-}
+// @DEPRECATED
<?php
-// Own namespace
-namespace CoreFramework\Deprecated;
-
-// Import framework stuff
-use CoreFramework\Database\DatabaseException;
-use CoreFramework\Generic\FrameworkInterface;
-
-/**
- * An exception thrown when the save path string is empty
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.org
- * @deprecated Please don't use this anymore.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class SavePathIsEmptyException extends DatabaseException {
- /**
- * The constructor
- *
- * @param $class Class throwing this exception
- * @param $code Code number for the exception
- * @return void
- */
- public function __construct (FrameworkInterface $class, $code) {
- // Add a message around the missing class
- $message = sprintf('[%s:%d] Save path is empty.',
- $class->__toString(),
- $this->getLine()
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-
-}
+// @DEPRECATED
<?php
-// Own namespace
-namespace CoreFramework\Deprecated;
-
-// Import framework stuff
-use CoreFramework\Generic\FrameworkException;
-
-// Import SPL stuff
-use \SplFileInfo;
-
-/**
- * An exception thrown when a file name is empty or NULL.
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.org
- * @deprecated Don't use this anymore
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class FileIsEmptyException extends FrameworkException {
- /**
- * The constructor
- *
- * @param $infoInstance An instance of a SplFileInfo class (ignored)
- * @param $code Code number for the exception
- * @return void
- */
- public function __construct (SplFileInfo $infoInstance, $code) {
- // Call parent constructor
- parent::__construct('No file name provided.', $code);
- }
-
-}
+// @DEPRECATED
<?php
-// Own namespace
-namespace CoreFramework\Filesystem;
-
-// Import framework stuff
-use CoreFramework\Generic\FrameworkException;
-use CoreFramework\Generic\FrameworkInterface;
-
-/**
- * An exception thrown when the path string is empty
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class PathIsEmptyException extends FrameworkException {
- /**
- * The constructor
- *
- * @param $class Class throwing this exception
- * @param $code Code number for the exception
- * @return void
- */
- public function __construct (FrameworkInterface $class, $code) {
- // Add a message around the missing class
- $message = sprintf('[%s:%d] Directory path is empty.',
- $class->__toString(),
- $this->getLine()
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-
-}
+// @DEPRECATED
<?php
-// Own namespace
-namespace CoreFramework\Localization;
-
-// Import framework stuff
-use CoreFramework\Generic\FrameworkException;
-use CoreFramework\Generic\FrameworkInterface;
-
-/**
- * An exception thrown when the language path string is empty
- *
- * @author Roland Haeder <webmaster@shipsimu.org>
- * @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
- * @license GNU GPL 3.0 or any newer version
- * @link http://www.shipsimu.org
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-class LanguagePathIsEmptyException extends FrameworkException {
- /**
- * The constructor
- *
- * @param $class Class throwing this exception
- * @param $code Code number for the exception
- * @return void
- */
- public function __construct (FrameworkInterface $class, $code) {
- // Add a message around the missing class
- $message = sprintf('[%s:%d] Language base path is empty.',
- $class->__toString(),
- $this->getLine()
- );
-
- // Call parent constructor
- parent::__construct($message, $code);
- }
-
-}
+// @DEPRECATED