<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="phar.cancompress" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>Phar::canCompress</refname>
  <refpurpose>Returns whether phar extension supports compression using either zlib or bzip2</refpurpose>
 </refnamediv>
 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis role="Phar">
   <modifier>final</modifier> <modifier>public</modifier> <modifier>static</modifier> <type>bool</type><methodname>Phar::canCompress</methodname>
   <methodparam choice="opt"><type>int</type><parameter>compression</parameter><initializer>0</initializer></methodparam>
  </methodsynopsis>

  <para>
   This should be used to test whether compression is possible prior to
   loading a phar archive containing compressed files.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>compression</parameter></term>
     <listitem>
      <para>
       Either <literal>Phar::GZ</literal> or <literal>Phar::BZ2</literal> can be
       used to test whether compression is possible with a specific compression
       algorithm (zlib or bzip2).
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>
 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   &true; if compression/decompression is available, &false; if not.
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>A <function>Phar::canCompress</function> example</title>
    <programlisting role="php">
<![CDATA[
<?php
if (Phar::canCompress()) {
    echo file_get_contents('phar://compressedphar.phar/internal/file.txt');
} else {
    echo 'no compression available';
}
?>
]]>
    </programlisting>
   </example>
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>PharFileInfo::getCompressedSize</function></member>
    <member><function>PharFileInfo::isCompressed</function></member>
    <member><function>PharFileInfo::compress</function></member>
    <member><function>PharFileInfo::decompress</function></member>
    <member><function>Phar::isCompressed</function></member>
    <member><function>Phar::compressFiles</function></member>
    <member><function>Phar::decompressFiles</function></member>
    <member><function>Phar::getSupportedCompression</function></member>
    <member><function>Phar::convertToExecutable</function></member>
    <member><function>Phar::convertToData</function></member>
   </simplelist>
  </para>
 </refsect1>


</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
