# ZendGuardLicenseTask

Extends \Task

Produce license files using Zeng Guard.

The task can produce a license file from the given license properties or it can use a template.

author | Petr Rybak petr@rynawe.net
version | $Id: 2e1e3730b96f5d5ea32d54fda8d9333b34eeaaba $
package | phing.tasks.ext.zendguard
since | 2.4.3

### Methods

## If temporary license file was created during the process this will remove it

    cleanupTmpFiles() : void

## Creates the signed license at the defined output path

    generateLicense() : void

throws |

## It will generate a temporary license template based on the properties defined.

    generateLicenseTemplate() : string

throws |

### Response

`string`

Path of the temporary license template file

## Generates license template content based on the defined parameters

    generateLicenseTemplateContent() : string

### Response

`string`

## Returns the textual description of the task

    getDescription() : string

inherited

### Response

`string`

The text description of the task

## Checks if the license template path is defined and returns it.

    getLicenseTemplatePath() : string

If it the license template path is not defined it will generate a temporary template file and provide it as a template.

### Response

`string`

## Returns the location within the buildfile this task occurs. Used by {@link BuildException} to give detailed error messages.

    getLocation() : \Location

inherited

### Response

`\Location`

The location object describing the position of this task within the buildfile.

## Returns the owning target of this task.

    getOwningTarget() : \Target

inherited

### Response

`\Target`

The target object that owns this task

## Returns a reference to current project

    getProject() : \Project

inherited

### Response

`\Project`

Reference to current porject object

## Returns a name

    getRegisterSlot(string $slotName) : \RegisterSlot

inherited

### Arguments

#### $slotName

`string`

### Response

`\RegisterSlot`

## Returns the wrapper object for runtime configuration

    getRuntimeConfigurableWrapper() : \RuntimeConfigurable

inherited

### Response

`\RuntimeConfigurable`

The wrapper object used by this task

## Returns the name of task, used only for log messages

    getTaskName() : string

inherited

### Response

`string`

Name of this task

## Returns the name of the task under which it was invoked, usually the XML tagname

    getTaskType() : string

inherited

### Response

`string`

The type of this task (XML Tag)

## Called by the parser to let the task initialize properly.

    init()

inherited

Should throw a BuildException if something goes wrong with the build

This is abstract here, but may not be overloaded by subclasses.

throws |

## Logs a message with the given priority.

    log(string $msg, integer $level = \Project::MSG_INFO) : void

inherited

### Arguments

#### $msg

`string`

The message to be logged.

#### $level

`integer`

The message's priority at this message should have

## Called by the project to let the task do it's work. This method may be called more than once, if the task is invoked more than once. For example, if target1 and target2 both depend on target3, then running <em>phing target1 target2</em> will run all tasks in target3 twice.

    main()

inherited abstract

Should throw a BuildException if someting goes wrong with the build

This is abstract here. Must be overloaded by real tasks.

## Configure this task if it hasn't been done already.

    maybeConfigure()

inherited

## Parse the given string in format like key1=value1;key2=value2;.

    parseAndAddUserDefinedValues(string $valueString, array &$valueArray, string $keyPrefix = '', string $pairSeparator = ';') : void

.. and converts it to array (key1=>value1, key2=value2, ...)

### Arguments

#### $valueString

`string`

Semi-colon separated value pairs

#### $valueArray

`array`

Array to which the values will be added

#### $keyPrefix

`string`

Prefix to use when adding the key

#### $pairSeparator

`string`

## Perfrom this task

    perform()

inherited

throws |

## Prepares and returns the command that will be used to create the license.

    prepareSignCommand() : string

### Response

`string`

## Sets a textual description of the task

    setDescription(string $desc)

inherited

### Arguments

#### $desc

`string`

The text describing the task

## Process the expires property. If the value is empty (false, '', .

    setExpires(mixed $expires) : string

..) it will set the value to 'Never' Otherwise it will run the value through strtotime so relative date and time notation can be used (e.g. +1 month)

throws |

### Arguments

#### $expires

`mixed`

### Response

`string`

## setHardwareLocked

    setHardwareLocked( $hardwareLocked)

### Arguments

#### $hardwareLocked

``

## setHostID

    setHostID( $hostID)

### Arguments

#### $hostID

``

## setIpRange

    setIpRange( $iprange)

### Arguments

#### $iprange

``

## setLicenseTemplate

    setLicenseTemplate( $value)

### Arguments

#### $value

``

## Sets the location within the buildfile this task occurs. Called by the parser to set location information.

    setLocation(\Location $location)

inherited

### Arguments

#### $location

`\Location`

The location object describing the position of this task within the buildfile.

## setOutputFile

    setOutputFile( $outputFile)

### Arguments

#### $outputFile

``

## Sets the owning target this task belongs to.

    setOwningTarget(\Target $target)

inherited

### Arguments

#### $target

`\Target`

## setPrivateKeyPath

    setPrivateKeyPath( $privateKeyPath)

### Arguments

#### $privateKeyPath

``

## setProductName

    setProductName( $productName)

### Arguments

#### $productName

``

## References the project to the current component.

    setProject(\Project $project) : void

inherited

### Arguments

#### $project

`\Project`

The reference to the current project

## setRegisteredTo

    setRegisteredTo( $registeredTo)

### Arguments

#### $registeredTo

``

## Sets the wrapper object this task should use for runtime configurable elements.

    setRuntimeConfigurableWrapper(\RuntimeConfigurable $wrapper)

inherited

### Arguments

#### $wrapper

`\RuntimeConfigurable`

The wrapper object this task should use

## Sets the name of this task for log messages

    setTaskName(string $name) : string

inherited

### Arguments

#### $name

`string`

### Response

`string`

A string representing the name of this task for log

## Sets the type of the task. Usually this is the name of the XML tag

    setTaskType( $name)

inherited

### Arguments

#### $name

``

## setUserDefinedValues

    setUserDefinedValues( $userDefinedValues)

### Arguments

#### $userDefinedValues

``

## setXUserDefinedValues

    setXUserDefinedValues( $xUserDefinedValues)

### Arguments

#### $xUserDefinedValues

``

## setZendsignPath

    setZendsignPath( $zendsignPath)

### Arguments

#### $zendsignPath

``

## Verifies that the configuration is correct

    verifyConfiguration()

throws |

### Properties

## zendsignCommand

    zendsignCommand :

### Type(s)

``

## tmpLicensePath

    tmpLicensePath :

### Type(s)

``

## Path to Zend Guard zendenc_sign executable

    zendsignPath : string

var |

### Type(s)

`string`

## Path to private key that will be used to sign the license

    privateKeyPath : string

var |

### Type(s)

`string`

## Where to store the signed license file

    outputFile : string

var |

### Type(s)

`string`

## Path to license template. If specified all license properties will be ignored and the template will be used to generate the file.

    licenseTemplate : string

var |

### Type(s)

`string`

## The name assigned to Product. This must be the same name used when encoding the PHP files.

    productName : string

REQUIRED

var |

### Type(s)

`string`

## The Name of the Registered owner of the license.

    registeredTo : string

REQUIRED

var |

### Type(s)

`string`

## Expiration date of the license. Used if the license is issued with a date restriction.

    expires : string

Possible values:

- 'Never', '0' or false: the license won't expire
- A Date in format DD-MM-YYYY to set expiration for that date
- Relative date supported by the PHP strtotime function (e.g. +1 month)

REQUIRED

var |

### Type(s)

`string`

## Limits the use of the license to IP addresses that fall within specification. Supports wildcards for any of the IP place holders, as well as the two types of net masks (filters).

    ipRange : string

Netmask pair An IP a.b.c.d, and a netmask w.x.y.z. (That is., 10.1.0.0/255.255.0.0), where the binary of mask is applied to filter IP addresses. ip/nnn (similar to a CIDR specification) This mask consists of nnn high-order 1 bits. (That is, 10.1.0.0/16 is the same as 10.1.0.0/255.255.0.0). Instead of spelling out the bits of the subnet mask, this mask notation is simply listed as the number of 1s bits that start the mask. Rather than writing the address and subnet mask as 192.60.128.0/255.255.252.0 the network address would be written simply as: 192.60.128.0/22 which indicates starting address of the network and number of 1s bits (22) in the network portion of the address. The mask in binary is (11111111.11111111.11111100.00000000).

OPTIONAL

Example (Wildcard): IP-Range = 10.1.. Example (Net Mask): IP-Range = 10.1.0.0/255.255.0.0 Example (Net Mask): IP-Range = 10.1.0.0/16

var |

### Type(s)

`string`

## Coded string (Zend Host ID) used to lock the license to a specific hardware. The Zend Host ID obtained from the machine where the encoded files and license are to be installed. The Zend Host ID code can be obtained by using the zendid utility.

    hostID : string

For more details, see Getting the Zend Host ID.

REQUIRED if Hardware-Locked is set equal to YES. Meaningless if Hardware-Locked is set equal to NO.

User semicolon to enter more than one Host-ID

Example: Host-ID = H:MFM43-Q9CXC-B9EDX-GWYSU;H:MFM43-Q9CXC-B9EDX-GWYTY

var |

### Type(s)

`string`

## Option that indicates if the license will be locked to a specific machine using the Zend Host ID code(s). If set to YES, the Host-ID is required.

    hardwareLocked : boolean

OPTIONAL

var |

### Type(s)

`boolean`

## Semi-colon separated user defined values that will be part of the license. These values CANNOT be modified after the license is produced. Modification would invalidate the license.

    userDefinedValues : string

OPTIONAL Example: Tea=Mint Flavor;Coffee=Arabica

var |

### Type(s)

`string`

## Semi-colon separated user defined x-values that will be part of the license. These values CAN be modified after the license is produced. Modification won't invalidate the license.

    xUserDefinedValues : string

OPTIONAL Example: Tea=Mint Flavor;Coffee=Arabica

var |

### Type(s)

`string`

## Owning Target object

    target : \Target

inherited

var |

### Type(s)

`\Target`

## Description of the task

    description : string

inherited

var |

### Type(s)

`string`

## Internal taskname (req)

    taskType : string

inherited

var |

### Type(s)

`string`

## Taskname for logger

    taskName : string

inherited

var |

### Type(s)

`string`

## Stored buildfile location

    location : \Location

inherited

var |

### Type(s)

`\Location`

## Wrapper of the task

    wrapper : \RuntimeConfigurable

inherited

var |

### Type(s)

`\RuntimeConfigurable`

## Holds a reference to the project that a project component (a task, a target, etc.) belongs to

    project : \Project

inherited

var | A reference to the current project instance

### Type(s)

`\Project`