MetaData is Metadata

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@322193 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Jakub Vrana 2012-01-13 11:42:48 +00:00
parent 7ac688dd80
commit 11c9ca2b19
5 changed files with 22 additions and 22 deletions

View file

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.getmetadata">
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.getMetadata">
<refnamediv>
<refname>Phar::getMetaData</refname>
<refname>Phar::getMetadata</refname>
<refpurpose>Returns phar archive meta-data</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>Phar::getMetaData</methodname>
<type>mixed</type><methodname>Phar::getMetadata</methodname>
<void/>
</methodsynopsis>
@ -35,7 +35,7 @@
&reftitle.examples;
<para>
<example>
<title>A <function>Phar::getMetaData</function> example</title>
<title>A <function>Phar::getMetadata</function> example</title>
<para>
</para>
<programlisting role="php">
@ -46,8 +46,8 @@
try {
$p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar');
$p['file.php'] = '<?php echo "hello";';
$p->setMetaData(array('bootstrap' => 'file.php'));
var_dump($p->getMetaData());
$p->setMetadata(array('bootstrap' => 'file.php'));
var_dump($p->getMetadata());
} catch (Exception $e) {
echo 'Could not modify phar:', $e;
}

View file

@ -66,7 +66,7 @@ $p['file.txt'] = 'hi';
$p['file2.txt'] = 'there';
$p['file2.txt']->setCompressedGZ();
$p['file3.txt'] = 'babyface';
$p['file3.txt']->setMetaData(42);
$p['file3.txt']->setMetadata(42);
$p->setStub("<?php
function __autoload($class)
{

View file

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="pharfileinfo.getmetadata">
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="pharfileinfo.getMetadata">
<refnamediv>
<refname>PharFileInfo::getMetaData</refname>
<refname>PharFileInfo::getMetadata</refname>
<refpurpose>Returns file-specific meta-data saved with a file</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>PharFileInfo::getMetaData</methodname>
<type>mixed</type><methodname>PharFileInfo::getMetadata</methodname>
<void/>
</methodsynopsis>
@ -34,7 +34,7 @@
&reftitle.examples;
<para>
<example>
<title>A <function>PharFileInfo::getMetaData</function> example</title>
<title>A <function>PharFileInfo::getMetadata</function> example</title>
<para>
</para>
<programlisting role="php">
@ -45,8 +45,8 @@
try {
$p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar');
$p['file.txt'] = 'hello';
$p['file.txt']->setMetaData(array('user' => 'bill', 'mime-type' => 'text/plain'));
var_dump($p['file.txt']->getMetaData());
$p['file.txt']->setMetadata(array('user' => 'bill', 'mime-type' => 'text/plain'));
var_dump($p['file.txt']->getMetadata());
} catch (Exception $e) {
echo 'Could not create/modify brandnewphar.phar: ', $e;
}

View file

@ -2,18 +2,18 @@
<!-- $Revision$ -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="pharfileinfo.setmetadata">
<refnamediv>
<refname>PharFileInfo::setMetaData</refname>
<refname>PharFileInfo::setMetadata</refname>
<refpurpose>Sets file-specific meta-data saved with a file</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>void</type><methodname>PharFileInfo::setMetaData</methodname>
<type>void</type><methodname>PharFileInfo::setMetadata</methodname>
<methodparam><type>mixed</type><parameter>metadata</parameter></methodparam>
</methodsynopsis>
<para>
<function>PharFileInfo::setMetaData</function> should only be used to store customized data in a file
<function>PharFileInfo::setMetadata</function> should only be used to store customized data in a file
that cannot be represented with existing information stored with a file.
Meta-data can significantly slow down the performance of loading a phar
archive if the data is large, or if there are many files containing meta-data.
@ -61,7 +61,7 @@
&reftitle.examples;
<para>
<example>
<title>A <function>PharFileInfo::setMetaData</function> example</title>
<title>A <function>PharFileInfo::setMetadata</function> example</title>
<para>
</para>
<programlisting role="php">
@ -72,7 +72,7 @@
try {
$p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar');
$p['file.txt'] = 'hello';
$p['file.txt']->setMetaData(array('user' => 'bill', 'mime-type' => 'text/plain'));
$p['file.txt']->setMetadata(array('user' => 'bill', 'mime-type' => 'text/plain'));
var_dump($p['file.txt']->getMetaData());
} catch (Exception $e) {
echo 'Could not create/modify phar: ', $e;

View file

@ -72,7 +72,7 @@ try {
echo file_get_contents($file->getPathName()) . "\n"; // display contents;
}
if (isset($p['internal/file.php'])) {
var_dump($p['internal/file.php']->getMetaData());
var_dump($p['internal/file.php']->getMetadata());
}
// create a new phar - phar.readonly must be 0 in php.ini
@ -102,9 +102,9 @@ try {
$p['images/wow.jpg'] = file_get_contents('images/wow.jpg');
// any value can be saved as file-specific meta-data
$p['images/wow.jpg']->setMetaData(array('mime-type' => 'image/jpeg'));
$p['images/wow.jpg']->setMetadata(array('mime-type' => 'image/jpeg'));
$p['index.php'] = file_get_contents('index.php');
$p->setMetaData(array('bootstrap' => 'index.php'));
$p->setMetadata(array('bootstrap' => 'index.php'));
// save the phar archive to disk
$p->stopBuffering();
@ -344,7 +344,7 @@ $f = file_get_contents('phar://myphar.phar/whatever.txt');
<para>
In addition, the <classname>Phar</classname> object is the only way to access
Phar-specific metadata, through
<function>Phar::getMetaData</function>,
<function>Phar::getMetadata</function>,
and the only way to set or retrieve a Phar archive's PHP loader stub through
<function>Phar::getStub</function> and
<function>Phar::setStub</function>.