4.2.5. Change Class

This cobbler replaces a class by another one, and leave the original class intact.

This cobbler is useful for inserting new classes instead of native PHP or library related ones: the usage shall be changed, but not the definition.

It might also be useful to update code, but keep older classes available for backward compatibility or fallback strategies.

4.2.5.1. Before

<?php

class oldClass {}

$a = new oldClass;

?>

4.2.5.2. After

<?php

class oldClass {}

$a = new newClass;

?>

4.2.5.3. Parameters

Name

Default

Type

Description

origin

name

The full namespace path name of the class to target.

newClass

name

The full namespace path name of the class to use.

destinationName

name

The name of the class to use. This may be used as an import alias

4.2.5.5. Reverse Cobbler

4.2.5.6. Specs

Short Name

Classes/ChangeClass

Exakat version

2.3.0

Available in