florianwolters/component-core-cloneable

Allows and disallows the cloning of objects as a PHP component.

v0.2.0 2013-03-19 16:49 UTC

This package is not auto-updated.

Last update: 2024-03-16 11:36:32 UTC


README

FlorianWolters\Component\Core\Cloneable is a simple-to-use PHP component that allows and disallows the cloning of objects.

Build Status Scrutinizer Code Quality Code Coverage SensioLabsInsight Coverage Status

Latest Stable Version Total Downloads Monthly Downloads Daily Downloads Latest Unstable Version License

Stories in Ready Dependency Status Dependencies Status HHVM Status

Table of Contents (ToC)

Introduction

This component is inspired by the the Java programming language.

FlorianWolters\Component\Core\Cloneable consists of six artifacts:

  1. The interface FlorianWolters\Component\Core\CloneableInterface: Indicates to the magic __clone method of a class that it is legal for that method to make a field-for-field copy of instances of that class.
  2. The exception class FlorianWolters\Component\Core\CloneNotSupportedException: Indicates that the magic __clone method in a class has been called to clone an object, but that the object's class does not implement the CloneableInterface.
  3. The trait FlorianWolters\Component\Core\CloneNotSupportedTrait: Indicates to the magic __clone method of a class that it is illegal for that method to make a field-for-field copy of instances of that class.
  4. The trait FlorianWolters\Component\Core\ShallowCloneTrait: Indicates to the magic __clone method of a class that it is legal for that method to make a shallow field-for-field copy of instances of that class.
  5. The trait FlorianWolters\Component\Core\DeepCloneTrait: Indicates to the magic __clone method of a class that it is legal for that method to make a deep field-for-field copy of instances of that class.
  6. The static class FlorianWolters\Component\Core\CloneUtils: Offers operations to clone objects.

Features

Requirements

Production

Development

Usage

The best documentation for FlorianWolters\Component\Core\Cloneable are the unit tests, which are shipped in the package.

Installation

FlorianWolters\Component\Core\Cloneable should be installed using the dependency manager Composer.

Composer is a tool for dependency management in PHP. It allows you to declare the dependent libraries your project needs and it will install them in your project for you.

The Composer installer can be downloaded with php.

php -r "readfile('https://getcomposer.org/installer');" | php

This will just check a few PHP settings and then download composer.phar to your working directory. This file is the Composer binary. It is a PHAR (PHP archive), which is an archive format for PHP which can be run on the command line, amongst other things.

To resolve and download dependencies, run the install command:

php composer.phar install

As A Dependency On Your Component

If you are creating a component that relies on FlorianWolters\Component\Core\Cloneable, please make sure that you add FlorianWolters\Component\Core\Cloneable to your component's composer.json file:

{
    "require": {
        "florianwolters/component-core-cloneable": "0.3.*"
    }
}

Contributing

See CONTRIBUTING.md.

Credits

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser 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 Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see http://gnu.org/licenses/lgpl.txt.