<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ぱんぴーまっしぐら &#187; php</title>
	<atom:link href="http://blog.cheki.net/archives/category/php/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.cheki.net</link>
	<description>悲しみの果てに</description>
	<lastBuildDate>Wed, 13 Jul 2011 02:39:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Mac OS XにPEARのインストール</title>
		<link>http://blog.cheki.net/archives/2356</link>
		<comments>http://blog.cheki.net/archives/2356#comments</comments>
		<pubDate>Fri, 01 Jul 2011 08:52:44 +0000</pubDate>
		<dc:creator>cockok</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[pear]]></category>

		<guid isPermaLink="false">http://blog.cheki.net/?p=2356</guid>
		<description><![CDATA[Mac OS XにPEARのインストール – ぱんぴーまっしぐら うまく行かなくなってたので。 $ curl -O http://pear.php.net/go-pear.phar $ php go-pear.phar  [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.cheki.net/archives/2296">Mac OS XにPEARのインストール – ぱんぴーまっしぐら</a><br />
うまく行かなくなってたので。</p>
<pre>
$ curl -O http://pear.php.net/go-pear.phar
$ php go-pear.phar
</pre>
<p>パイプでつなぐとreadlineがうまくいかないので別で実行。<br />
ユーザー環境にインストールしようとするのでそのままEnter</p>
<pre>
~/pear/bin/pear help
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.cheki.net/archives/2356/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>twitpicへの画像投稿</title>
		<link>http://blog.cheki.net/archives/2300</link>
		<comments>http://blog.cheki.net/archives/2300#comments</comments>
		<pubDate>Sat, 30 Oct 2010 12:26:05 +0000</pubDate>
		<dc:creator>cockok</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[twitpic]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://blog.cheki.net/?p=2300</guid>
		<description><![CDATA[twitter利用時に画像ストレージとして利用されることが多いTwitPic。 以前は、twitterのID、パスワードを投げる仕様でしたが、OAuth対応後は、token、keyを投げる仕様となっていました。 toke [...]]]></description>
			<content:encoded><![CDATA[<p>twitter利用時に画像ストレージとして利用されることが多いTwitPic。<br />
以前は、twitterのID、パスワードを投げる仕様でしたが、OAuth対応後は、token、keyを投げる仕様となっていました。<br />
token、keyをまんま投げたら認証キーを削除できる程度で、ID、パスワード投げるのと変わらないんですけどね。</p>
<p><a href="http://dev.twitpic.com/docs/2/upload/">TwitPic Developers &#8211; API Documentation &#8211; API v2 » upload</a></p>
<p>v2ではtwitterとOAuth認証で利用するヘッダを「X-Verify-Credentials-Authorization」として、リクエストURIを「X-Auth-Service-Provider」としてヘッダに含めることでAPIを利用できるようになりました。</p>
<p>以下、PEAR::HTTP_Request2とPEAR::HTTP_OAuthを利用したサンプル。</p>
<pre>
&lt;?php
require_once &#039;HTTP/OAuth/Consumer.php&#039;;

define(&#039;OAUTH_CONSUMER_KEY&#039;,    &#039;xxxx&#039;);
define(&#039;OAUTH_CONSUMER_SECRET&#039;, &#039;xxxx&#039;);
define(&#039;OAUTH_TOKEN&#039;,           &#039;xxxx&#039;);
define(&#039;OAUTH_TOKEN_SECRET&#039;,    &#039;xxxx&#039;);
define(&#039;TWITPIC_KEY&#039;,           &#039;xxxx&#039;);

try {

  $consumer_request = new HTTP_OAuth_Consumer_Request();
  $consumer_request-&gt;accept(new HTTP_Request2());

  $consumer = new HTTP_OAuth_Consumer(OAUTH_CONSUMER_KEY,
                                      OAUTH_CONSUMER_SECRET,
                                      OAUTH_TOKEN,
                                      OAUTH_TOKEN_SECRET);
  $consumer-&gt;accept($consumer_request);
  $resp = $consumer-&gt;sendRequest(&#039;https://api.twitter.com/1/account/verify_credentials.json&#039;, array(), HTTP_Request2::METHOD_GET);

  $headers = $consumer-&gt;getLastRequest()-&gt;getHeaders();

  $http_request = new HTTP_Request2();
  $http_request-&gt;setHeader(&#039;X-Auth-Service-Provider&#039;, &#039;https://api.twitter.com/1/account/verify_credentials.json&#039;);
  $http_request-&gt;setHeader(&#039;X-Verify-Credentials-Authorization&#039;, $headers[&#039;authorization&#039;]);
  $http_request-&gt;setUrl(&#039;http://api.twitpic.com/2/upload.json&#039;);
  $http_request-&gt;setMethod(HTTP_Request2::METHOD_POST);
  $http_request-&gt;addPostParameter(&#039;key&#039;, TWITPIC_KEY);
  $http_request-&gt;addPostParameter(&#039;message&#039;, &#039;test&#039;);
  $http_request-&gt;addUpload(&#039;media&#039;, &#039;/path/to/image&#039;);
  $resp = $http_request-&gt;send();
  $body = $resp-&gt;getBody();
  $body = json_decode($body);

  var_dump($body);

} catch (Exception $e) {

  var_dump($e-&gt;getMessage());

}
</pre>
<p>twitterとのOAuth認証に必要なAuthorizationヘッダを生成するだけでよいので、実際はtwitter側にリクエストする必要はないのですが、ソース読んだところいろいろ面倒なのでとりあえずこんな形で。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cheki.net/archives/2300/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP5.3.0～2の罠</title>
		<link>http://blog.cheki.net/archives/2242</link>
		<comments>http://blog.cheki.net/archives/2242#comments</comments>
		<pubDate>Thu, 02 Sep 2010 07:43:18 +0000</pubDate>
		<dc:creator>cockok</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[pear]]></category>

		<guid isPermaLink="false">http://blog.cheki.net/?p=2242</guid>
		<description><![CDATA[PHP5.3.3では以下のような「後方非互換の変更」が加えられています。 Methods with the same name as the last element of a namespaced class name [...]]]></description>
			<content:encoded><![CDATA[<p>PHP5.3.3では以下のような「後方非互換の変更」が加えられています。</p>
<blockquote><p>
Methods with the same name as the last element of a namespaced class name will no longer be treated as constructor. This change doesn&#8217;t affect non-namespaced classes.</p>
<pre>&lt;?php
namespace Foo;
class Bar {
    public function Bar() {
        // treated as constructor in PHP 5.3.0-5.3.2
        // treated as regular method in PHP 5.3.3
    }
}
?&gt;</pre>
<p>There is no impact on migration from 5.2.x because namespaces were only introduced in PHP 5.3.<br />
<a href="http://www.php.net/archive/2010.php#id2010-07-22-2">PHP 5.3.3 Released!</a>
</p></blockquote>
<p>どういう事かというと、</p>
<pre>
&lt;?php
class A
{
  function A()
  {
    echo __CLASS__;
  }
}
class B extends A
{
}
class C extends B
{
  function C()
  {
    parent::B();
  }
}
new C();
</pre>
<p>結果<br />
PHP5.3.2</p>
<pre>PHP Fatal error:  Call to undefined method B::B()</pre>
<p>PHP5.3.3</p>
<pre>A</pre>
<p>PHP5.3.xによってPHP4に対する後方互換が崩れたんですが、PHP5.3.3でPHP5.3.x非互換となる代わりにPHP4後方互換が一部戻ったという話。<br />
PEAR::Image_Graphで問題でてました。<br />
PHP5の環境なら以下のように書くので問題は起こらないんですけどね。</p>
<pre>
&lt;?php
class A
{
  public function __construct()
  {
    echo __CLASS__;
  }
}
class B extends A
{
}
class C extends B
{
  public function __construct()
  {
    parent::__construct();
  }
}
new C();
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.cheki.net/archives/2242/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PEAR::Services_Twitterのパッチ</title>
		<link>http://blog.cheki.net/archives/2218</link>
		<comments>http://blog.cheki.net/archives/2218#comments</comments>
		<pubDate>Tue, 24 Aug 2010 10:22:28 +0000</pubDate>
		<dc:creator>cockok</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://blog.cheki.net/?p=2218</guid>
		<description><![CDATA[Services_Twitter_r302262.diff 7904 byte [md5] 89930ad5cf340af7a101ed74261d4a34 修正 sendOAuthRequest()メソッドでHTTP_ [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.cheki.net/Services_Twitter_r302262.diff">Services_Twitter_r302262.diff</a><br />
7904 byte<br />
[md5] 89930ad5cf340af7a101ed74261d4a34</p>
<p>修正<br />
sendOAuthRequest()メソッドでHTTP_OAuth_Exceptionがthrowされる問題<br />
serchメソッドでhttp://search.twitter.comを利用しない問題<br />
blocks/createメソッドでuser_id、screen_nameを指定できない問題<br />
blocks/destroyメソッドでuser_id、screen_nameを指定できない問題<br />
テストでOAuthの場合sourceはアプリケーションになる問題<br />
テストでutf8テストが二重投稿になる問題<br />
テストでOAuthの場合オブジェクトがHTTP_OAuth_Consumer_Responseになる問題</p>
<p>追加<br />
blocks/bloking/idsメソッド (call $t->blocks->blocking_ids())</p>
<pre>
$ svn export -r 302262 http://svn.php.net/repository/pear/packages/Services_Twitter/trunk Services_Twitter
$ wget http://blog.cheki.net/Services_Twitter_r302262.diff
$ cd Services_Twitter
$ patch -p0 < ../services_twitter.diff
patching file Services/Twitter.php
patching file data/api.xml
patching file tests/900-exceptions.phpt
patching file tests/910-options.phpt
patching file tests/920-utf8.phpt
patching file tests/data/utf8-2.dat
patching file tests/setup.php
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.cheki.net/archives/2218/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PEAR::Services_Twitterをforkした</title>
		<link>http://blog.cheki.net/archives/2207</link>
		<comments>http://blog.cheki.net/archives/2207#comments</comments>
		<pubDate>Wed, 18 Aug 2010 17:35:58 +0000</pubDate>
		<dc:creator>cockok</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://blog.cheki.net/?p=2207</guid>
		<description><![CDATA[Services_Twitter 以前パッチが取り込まれたけど、Basic認証でしか確認してなくて、OAuthだとDELETEメソッドで問題がでてました。 その他なんか迷走してる感じだったので、パッチ送りたいなとPEAR [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://pear.php.net/package/Services_Twitter/">Services_Twitter</a><br />
以前パッチが取り込まれたけど、Basic認証でしか確認してなくて、OAuthだとDELETEメソッドで問題がでてました。<br />
その他なんか迷走してる感じだったので、パッチ送りたいなとPEARアカウントを取得しようと申請したのですがレスポンスがないので、とりあえずgithubにぶち込んだ次第です。<br />
バグレポートもパッチ投げるにもPEARアカウントないと半匿名な感じになるので。</p>
<p><a href="http://github.com/cockok/Services_Twitter">cockok&apos;s Services_Twitter at master &#8211; GitHub</a></p>
<p>リリース最新は0.6.2ですが、trunkが変更されてたのでそちらをfork。<br />
あいきゃんとすぴーくいんぐりっしゅ。<br />
もちろん書くのも。</p>
<p>ちなみに、DELETEメソッドででる問題は、RFC2616に以下のようなところ。</p>
<blockquote><p>The DELETE method requests that the origin server delete the resource identified by the Request-URI.<br />
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.7">HTTP/1.1: Method Definitions</a></p></blockquote>
<p>こっちはPEAR::HTTP_OAuthの問題。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cheki.net/archives/2207/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PEARをローカルにインストール</title>
		<link>http://blog.cheki.net/archives/2192</link>
		<comments>http://blog.cheki.net/archives/2192#comments</comments>
		<pubDate>Wed, 11 Aug 2010 01:56:58 +0000</pubDate>
		<dc:creator>cockok</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[pear]]></category>

		<guid isPermaLink="false">http://blog.cheki.net/?p=2192</guid>
		<description><![CDATA[Manual :: 共有ホストでの PEAR のローカルコピーのインストール 既にpearコマンドが利用可能な場合。 $ pear config-create /path/to ~/.pearrc /path/to/pe [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://pear.php.net/manual/ja/installation.shared.php">Manual :: 共有ホストでの PEAR のローカルコピーのインストール</a></p>
<p>既にpearコマンドが利用可能な場合。</p>
<pre>
$ pear config-create /path/to ~/.pearrc
</pre>
<p>/path/to/pear以下に諸々配置される設定ファイルが~/.pearrcとして作成される。<br />
この場合、PEARディレクトリは/path/to/pear/phpとなる。</p>
<p>ディレクトリ等、設定をを変更したい場合は、通常通りpear config-setコマンドで。</p>
<p>phpコマンドを実行する際にinclude_pathの設定をしたいが、オプションでは指定できないので、php.iniを別途準備し読むように指定するaliasを設定。</p>
<pre>
$ cp /etc/php.ini /path/to
$ vim /path/to/php.ini
$ alias php='php -c /path/to/php.ini'
</pre>
<p>php.iniのinclude_pathの設定は以下のようにローカルのPEARディレクトリしか読み込まない、または、優先的に読み込むように設定。</p>
<pre>
include_path = ".:/path/to/php"
#include_path = ".:/path/to/php:/usr/share/pear:/usr/share/php"
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.cheki.net/archives/2192/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHPでクライアントベースのOAuth認証</title>
		<link>http://blog.cheki.net/archives/2193</link>
		<comments>http://blog.cheki.net/archives/2193#comments</comments>
		<pubDate>Fri, 06 Aug 2010 19:32:17 +0000</pubDate>
		<dc:creator>cockok</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://blog.cheki.net/?p=2193</guid>
		<description><![CDATA[まさに誰得。 ブラウザベースは情報いっぱいあったんだけど、クライアントベースが見つからなかったので。 取得したaccess_token、access_token_secretを利用の仕方は下記で。 PEAR::HTTP_ [...]]]></description>
			<content:encoded><![CDATA[<p>まさに誰得。<br />
ブラウザベースは情報いっぱいあったんだけど、クライアントベースが見つからなかったので。<br />
取得したaccess_token、access_token_secretを利用の仕方は下記で。<br />
<a href="http://blog.cheki.net/archives/1630">PEAR::HTTP_OAuthでxAuth – ぱんぴーまっしぐら</a></p>
<pre>
#!/usr/bin/env php
&lt;?php
require_once &#039;HTTP/OAuth/Consumer.php&#039;;

define(&#039;CONSUMER_KEY&#039;,    &#039;xxxxxxxxxxxxxxxxxxxx&#039;);
define(&#039;CONSUMER_SECRET&#039;, &#039;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&#039;);

try {

  $http_request = new HTTP_Request2();
  $http_request-&gt;setConfig(&#039;ssl_verify_peer&#039;, false);

  $consumer_request = new HTTP_OAuth_Consumer_Request();
  $consumer_request-&gt;accept($http_request);

  $consumer = new HTTP_OAuth_Consumer(CONSUMER_KEY, CONSUMER_SECRET);
  $consumer-&gt;accept($consumer_request);

  $consumer-&gt;getRequestToken(&#039;http://twitter.com/oauth/request_token&#039;);
  $url = $consumer-&gt;getAuthorizeUrl(&#039;http://twitter.com/oauth/authorize&#039;);

  if (!$stdin = fopen(&#039;php://stdin&#039;, &#039;r&#039;)) {
    throw new Exception(&#039;stdin open failed&#039;);
  }

  echo &#039;Visit the following URL in your browser to authenticate twitter: &#039;;
  echo $url.&quot;\n&quot;;
  echo &#039;Enter Twitter OAuth PIN: &#039;;
  $pin = trim(fgets($stdin, 64));
  $consumer-&gt;getAccessToken(&#039;http://twitter.com/oauth/access_token&#039;, $pin);

  echo &#039;access_token: &#039;.$consumer-&gt;getToken().&quot;\n&quot;;
  echo &#039;access_token_secret: &#039;.$consumer-&gt;getTokenSecret().&quot;\n&quot;;

} catch (Exception $e) {

  echo $e-&gt;getMessage().&#039; in &#039;.$e-&gt;getFile().&#039; line &#039;.$e-&gt;getLine().&quot;\n&quot;;
  exit(1);

}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.cheki.net/archives/2193/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PEAR準拠の構文チェック</title>
		<link>http://blog.cheki.net/archives/2181</link>
		<comments>http://blog.cheki.net/archives/2181#comments</comments>
		<pubDate>Sun, 01 Aug 2010 07:55:22 +0000</pubDate>
		<dc:creator>cockok</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.cheki.net/?p=2181</guid>
		<description><![CDATA[Manual :: コードの提供にあたっての要求事項 インストール # yum --enablerepo=remi,epel install php-pear-PHP-CodeSniffer 使い方 $ phpcs ho [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://pear.php.net/manual/ja/developers.contributing.requirements.php">Manual :: コードの提供にあたっての要求事項</a></p>
<h3>インストール</h3>
<pre>
# yum --enablerepo=remi,epel install php-pear-PHP-CodeSniffer
</pre>
<h3>使い方</h3>
<pre>
$ phpcs hoge.php
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.cheki.net/archives/2181/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Services_Twitter::sendOAuthRequest</title>
		<link>http://blog.cheki.net/archives/2137</link>
		<comments>http://blog.cheki.net/archives/2137#comments</comments>
		<pubDate>Wed, 14 Jul 2010 03:30:41 +0000</pubDate>
		<dc:creator>cockok</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://blog.cheki.net/?p=2137</guid>
		<description><![CDATA[Services_Twitter::sendOAuthRequestではHTTP_Request2_Exceptionをcatchしていますが、実際はHTTP_OAuth_Exceptionをcatchしなきゃいけない。 [...]]]></description>
			<content:encoded><![CDATA[<p>Services_Twitter::sendOAuthRequestではHTTP_Request2_Exceptionをcatchしていますが、実際はHTTP_OAuth_Exceptionをcatchしなきゃいけない。</p>
<p>Services_Twitterはベーシック認証周りは大丈夫だと思いますが、OAuth周りはまともにテストされてないので、結構バグあります。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cheki.net/archives/2137/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>あとで書くよ</title>
		<link>http://blog.cheki.net/archives/2126</link>
		<comments>http://blog.cheki.net/archives/2126#comments</comments>
		<pubDate>Mon, 05 Jul 2010 04:31:11 +0000</pubDate>
		<dc:creator>cockok</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.cheki.net/?p=2126</guid>
		<description><![CDATA[services_twitterのprepareRequestメソッド protected function prepareRequest($endpoint, array $args = array(), $cat = [...]]]></description>
			<content:encoded><![CDATA[<p>services_twitterのprepareRequestメソッド</p>
<p><span id="more-2126"></span></p>
<pre>
  protected function prepareRequest($endpoint, array $args = array(), $cat = null)
  {
    $params = array();
    $files  = array();

    // check if we have is a search or trends call, in this case the base
    // uri is different
    if (   $cat == 'search'
      || ( $cat == 'trends'
        &#038;&#038; !in_array((string)$endpoint['name'], array('available', 'location'))
      )
    ) {
      $uri = self::$searchUri;
    } else {
      $uri = self::$uri;
    }

    // ssl requested
    if ($this->getOption('use_ssl')) {
      $uri = str_replace('http://', 'https://', $uri);
    }

    // build the uri path
    if (!isset($endpoint['routing'])) {
      $path = '/';
      if ($cat !== null) {
        $path .= $cat . '/';
      }
      $path  .= (string)$endpoint['name'];
    } else {
      $path = (string)$endpoint['routing'];
    }
    $method = (string)$endpoint['method'];

    // check if we have a POST method and a registered source to pass
    $source = $this->getOption('source');
    if ($method == 'POST' &#038;&#038; $source !== null) {
      $params['source'] = $source;
    }

    // check arguments requirements
    $minargs = isset($endpoint['min_args'])
      ? (int)$endpoint['min_args']
      : count($endpoint->xpath('param[@required="true" or @required="1"]'));
    if (!$minargs &#038;&#038; (isset($args[0]) &#038;&#038; !is_array($args[0]))) {
      throw new Services_Twitter_Exception(
          $path . ' expects an array as unique parameter',
          self::ERROR_PARAMS,
          $path
          );
    }
    if (   $minargs &#038;&#038; (!isset($args[0])
          || is_array($args[0])
          &#038;&#038; $minargs > count($args[0]))
       ) {
      throw new Services_Twitter_Exception(
          'Not enough arguments for ' . $path,
          self::ERROR_PARAMS,
          $path
          );
    }
    $needargs = $minargs;

    // now process arguments according to their definition in the xml
    // mapping
    foreach ($endpoint->param as $param) {
      $pName      = (string)$param['name'];
      $pType      = (string)$param['type'];
      $pMaxLength = (int)$param['max_length'];
      $pMaxLength = $pMaxLength > 0 ? $pMaxLength : null;
      $pReq       = (string)$param['required'] == 'true' || $needargs;
      if ($pReq &#038;&#038; !is_array($args[0])) {
        $arg = array_shift($args);
        $needargs--;
      } else if (isset($args[0][$pName])) {
        $arg = $args[0][$pName];
        $needargs--;
      } else {
        continue;
      }
      try {
        $this->validateArg($pName, $arg, $pType, $pMaxLength);
      } catch (Exception $exc) {
        throw new Services_Twitter_Exception(
            $path . ': ' . $exc->getMessage(),
            self::ERROR_PARAMS,
            $path
            );
      }
      if ($pName == 'id' &#038;&#038; !isset($endpoint['routing'])) {
        $path .= '/' . $arg;
      } else {
        if (strpos($path, ':') !== false) {
            $path = preg_replace('/:'.preg_quote($pName).'(\/|$)/', rawurlencode($arg).'$1', $path);
        } else {
          if ($pType == 'string' &#038;&#038; !$this->isUtf8($arg)) {
            // iso-8859-1 string that we must convert to unicode
            $arg = utf8_encode($arg);
          }
          if ($pType == 'image') {
            // we have a file upload
            $files[$pName] = $arg;
          } else {
            $params[$pName] = $arg;
          }
        }
      }
    }
    $uri .= $path . '.' . $this->getOption('format');

    return array($uri, $method, $params, $files);
  }
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.cheki.net/archives/2126/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

