Skip to content
This repository has been archived by the owner on Jul 8, 2023. It is now read-only.

Commit

Permalink
Found some old code. Pushing before system wipe.
Browse files Browse the repository at this point in the history
  • Loading branch information
ezzatron committed Jan 31, 2015
1 parent c84a45e commit ef8ea1b
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 29 deletions.
8 changes: 4 additions & 4 deletions src/Exception/AbstractInvalidPathAtomException.php
Expand Up @@ -23,10 +23,10 @@ abstract class AbstractInvalidPathAtomException extends Exception
/**
* Construct a new invalid path atom exception.
*
* @param string $atom The invalid path atom.
* @param Exception|null $previous The cause, if available.
* @param string $atom The invalid path atom.
* @param Exception|null $cause The cause, if available.
*/
public function __construct($atom, Exception $previous = null)
public function __construct($atom, Exception $cause = null)
{
$this->atom = $atom;

Expand All @@ -37,7 +37,7 @@ public function __construct($atom, Exception $previous = null)
$this->reason()
),
0,
$previous
$cause
);
}

Expand Down
8 changes: 4 additions & 4 deletions src/Exception/AbstractInvalidPathException.php
Expand Up @@ -24,10 +24,10 @@ abstract class AbstractInvalidPathException extends Exception
/**
* Construct a new invalid path exception.
*
* @param PathInterface $path The invalid path.
* @param Exception|null $previous The cause, if available.
* @param PathInterface $path The invalid path.
* @param Exception|null $cause The cause, if available.
*/
public function __construct(PathInterface $path, Exception $previous = null)
public function __construct(PathInterface $path, Exception $cause = null)
{
$this->path = $path;

Expand All @@ -38,7 +38,7 @@ public function __construct(PathInterface $path, Exception $previous = null)
$this->reason()
),
0,
$previous
$cause
);
}

Expand Down
6 changes: 3 additions & 3 deletions src/Exception/EmptyPathAtomException.php
Expand Up @@ -21,11 +21,11 @@ final class EmptyPathAtomException extends AbstractInvalidPathAtomException
/**
* Construct a new empty path atom exception.
*
* @param Exception|null $previous The cause, if available.
* @param Exception|null $cause The cause, if available.
*/
public function __construct(Exception $previous = null)
public function __construct(Exception $cause = null)
{
parent::__construct('', $previous);
parent::__construct('', $cause);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Exception/EmptyPathException.php
Expand Up @@ -21,14 +21,14 @@ final class EmptyPathException extends Exception
/**
* Construct a new empty path exception.
*
* @param Exception|null $previous The cause, if available.
* @param Exception|null $cause The cause, if available.
*/
public function __construct(Exception $previous = null)
public function __construct(Exception $cause = null)
{
parent::__construct(
'Relative paths must have at least one atom.',
0,
$previous
$cause
);
}
}
6 changes: 3 additions & 3 deletions src/Exception/InvalidPathAtomCharacterException.php
Expand Up @@ -23,13 +23,13 @@ final class InvalidPathAtomCharacterException extends AbstractInvalidPathAtomExc
*
* @param string $atom The invalid path atom.
* @param string $character The invalid character.
* @param Exception|null $previous The cause, if available.
* @param Exception|null $cause The cause, if available.
*/
public function __construct($atom, $character, Exception $previous = null)
public function __construct($atom, $character, Exception $cause = null)
{
$this->character = $character;

parent::__construct($atom, $previous);
parent::__construct($atom, $cause);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/Exception/InvalidPathStateException.php
Expand Up @@ -21,17 +21,17 @@ final class InvalidPathStateException extends Exception
/**
* Construct a new invalid path state exception.
*
* @param string $reason The reason message.
* @param Exception|null $previous The cause, if available.
* @param string $reason The reason message.
* @param Exception|null $cause The cause, if available.
*/
public function __construct($reason, Exception $previous = null)
public function __construct($reason, Exception $cause = null)
{
$this->reason = $reason;

parent::__construct(
sprintf('Invalid path state. %s', $reason),
0,
$previous
$cause
);
}

Expand Down
13 changes: 5 additions & 8 deletions src/Exception/UndefinedAtomException.php
Expand Up @@ -21,20 +21,17 @@ final class UndefinedAtomException extends Exception
/**
* Construct a new undefined atom exception.
*
* @param integer $index The requested atom index.
* @param Exception|null $previous The cause, if available.
* @param integer $index The requested atom index.
* @param Exception|null $cause The cause, if available.
*/
public function __construct($index, Exception $previous = null)
public function __construct($index, Exception $cause = null)
{
$this->index = $index;

parent::__construct(
sprintf(
'No atom defined for index %s.',
var_export($index, true)
),
sprintf('No atom defined for index %s.', var_export($index, true)),
0,
$previous
$cause
);
}

Expand Down
34 changes: 34 additions & 0 deletions src/Exception/UnknownPathException.php
@@ -0,0 +1,34 @@
<?php

/*
* This file is part of the Pathogen package.
*
* Copyright © 2014 Erin Millard
*
* For the full copyright and license information, please view the LICENSE file
* that was distributed with this source code.
*/

namespace Eloquent\Pathogen\Exception;

use Exception;

/**
* The requested path could not be determined.
*/
final class UnknownPathException extends Exception
{
/**
* Construct a new unknown path exception.
*
* @param Exception|null $cause The cause, if available.
*/
public function __construct(Exception $cause = null)
{
parent::__construct(
'The requested path could not be determined.',
0,
$cause
);
}
}
20 changes: 20 additions & 0 deletions src/FileSystem/Factory/AbstractFileSystemPathFactory.php
Expand Up @@ -78,6 +78,26 @@ public function createWorkingDirectoryPath()
->create($this->isolator()->getcwd());
}

/**
* Create a path representing the home directory of the current user.
*
* @return AbsoluteFileSystemPathInterface A new path instance representing the current user's home directory path.
*/
public function createHomeDirectoryPath()
{
$isolator = $this->isolator();
if ($isolator->function_exists('posix_geteuid')) {

} elseif ($isolator->getenv('HOME')) {

} elseif ($isolator->getenv('HOMEDRIVE')) {

}

return $this->factoryByPlatform()
->create($this->isolator()->getcwd());
}

/**
* Create a path representing the system temporary directory.
*
Expand Down
7 changes: 7 additions & 0 deletions src/FileSystem/Factory/FileSystemPathFactoryInterface.php
Expand Up @@ -26,6 +26,13 @@ interface FileSystemPathFactoryInterface extends PathFactoryInterface
*/
public function createWorkingDirectoryPath();

/**
* Create a path representing the home directory of the current user.
*
* @return AbsoluteFileSystemPathInterface A new path instance representing the current user's home directory path.
*/
public function createHomeDirectoryPath();

/**
* Create a path representing the system temporary directory.
*
Expand Down

0 comments on commit ef8ea1b

Please sign in to comment.