Compare commits

...

10 Commits

Author SHA1 Message Date
ee67a82f64 Add clone() Method 2025-10-25 11:52:31 -04:00
577b2d3eeb Create CloneableTrait 2025-10-25 11:50:27 -04:00
9d669625bb Create Cloneable 2025-10-25 11:49:48 -04:00
a558567ba9 Create AbstractCloneable 2025-10-25 11:49:38 -04:00
59e0f3eb5b Create CloneableInterface 2025-10-25 11:49:23 -04:00
42a0e9b97d composer init 2025-10-25 11:47:20 -04:00
79909e0877 Add first name to Copyright 2025-10-25 11:46:31 -04:00
404d5b71f4 Add composer.lock and /nbproject/ 2025-10-25 11:45:22 -04:00
jay
8947606d57 Revert "Add composer.lock and /nbproject/"
This reverts commit e560875d9e.
2025-10-25 11:44:34 -04:00
jay
e560875d9e Add composer.lock and /nbproject/ 2025-10-25 11:43:25 -04:00
7 changed files with 67 additions and 8 deletions

10
.gitignore vendored
View File

@@ -1,8 +1,4 @@
# ---> Composer
composer.lock
composer.phar
/vendor/
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock
/nbproject/
/vendor/

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2025 Potter
Copyright (c) 2025 Jay Potter
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including

20
composer.json Normal file
View File

@@ -0,0 +1,20 @@
{
"name": "potter/cloneable",
"type": "library",
"require": {
"php": "^8.4"
},
"license": "MIT",
"autoload": {
"psr-4": {
"Potter\\Cloneable\\": "src/Potter/Cloneable/"
}
},
"authors": [
{
"name": "Jay Potter",
"email": "j@ypotter.ca"
}
],
"minimum-stability": "dev"
}

View File

@@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Potter\Cloneable;
abstract class AbstractCloneable implements CloneableInterface
{
abstract public function clone(): CloneableInterface;
}

View File

@@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Potter\Cloneable;
abstract class Cloneable extends AbstractCloneable
{
use CloneableTrait;
}

View File

@@ -0,0 +1,10 @@
<?php
declare(strict_types=1);
namespace Potter\Cloneable;
interface CloneableInterface
{
public function clone(): self;
}

View File

@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace Potter\Cloneable;
trait CloneableTrait
{
final public function clone(): CloneableInterface
{
return clone $this;
}
}