当前位置: 首页>>代码示例>>PHP>>正文


PHP PropPatch::handleRemaining方法代码示例

本文整理汇总了PHP中Sabre\DAV\PropPatch::handleRemaining方法的典型用法代码示例。如果您正苦于以下问题:PHP PropPatch::handleRemaining方法的具体用法?PHP PropPatch::handleRemaining怎么用?PHP PropPatch::handleRemaining使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sabre\DAV\PropPatch的用法示例。


在下文中一共展示了PropPatch::handleRemaining方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateAddressBook

 /**
  * Updates properties for an address book.
  *
  * The list of mutations is stored in a Sabre\DAV\PropPatch object.
  * To do the actual updates, you must tell this object which properties
  * you're going to process with the handle() method.
  *
  * Calling the handle method is like telling the PropPatch object "I
  * promise I can handle updating this property".
  *
  * Read the PropPatch documenation for more info and examples.
  *
  * @param string $addressBookId
  * @param \Sabre\DAV\PropPatch $propPatch
  * @return void
  */
 public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch)
 {
     foreach ($this->addressBooks as &$book) {
         if ($book['id'] !== $addressBookId) {
             continue;
         }
         $propPatch->handleRemaining(function ($mutations) use(&$book) {
             foreach ($mutations as $key => $value) {
                 $book[$key] = $value;
             }
             return true;
         });
     }
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:30,代码来源:Mock.php

示例2: propPatch

 /**
  * Updates properties for a path
  *
  * This method received a PropPatch object, which contains all the
  * information about the update.
  *
  * Usually you would want to call 'handleRemaining' on this object, to get;
  * a list of all properties that need to be stored.
  *
  * @param string $path
  * @param PropPatch $propPatch
  * @return void
  */
 function propPatch($path, PropPatch $propPatch)
 {
     $propPatch->handleRemaining(function ($properties) use($path) {
         $updateStmt = $this->pdo->prepare("REPLACE INTO propertystorage (path, name, value) VALUES (?, ?, ?)");
         $deleteStmt = $this->pdo->prepare("DELETE FROM propertystorage WHERE path = ? AND name = ?");
         foreach ($properties as $name => $value) {
             if (!is_null($value)) {
                 $updateStmt->execute([$path, $name, $value]);
             } else {
                 $deleteStmt->execute([$path, $name]);
             }
         }
         return true;
     });
 }
开发者ID:MetallianFR68,项目名称:myroundcube,代码行数:28,代码来源:PDO.php

示例3: propPatch

 /**
  * Updates properties on this node.
  *
  * This method received a PropPatch object, which contains all the
  * information about the update.
  *
  * To update specific properties, call the 'handle' method on this object.
  * Read the PropPatch documentation for more information.
  *
  * @param PropPatch $propPatch
  * @return void
  */
 function propPatch(PropPatch $propPatch)
 {
     $propPatch->handleRemaining(function (array $properties) {
         $resourceData = $this->getResourceData();
         foreach ($properties as $propertyName => $propertyValue) {
             // If it was null, we need to delete the property
             if (is_null($propertyValue)) {
                 unset($resourceData['properties'][$propertyName]);
             } else {
                 $resourceData['properties'][$propertyName] = $propertyValue;
             }
         }
         $this->putResourceData($resourceData);
         return true;
     });
 }
开发者ID:bogolubov,项目名称:owncollab_talks-1,代码行数:28,代码来源:Node.php

示例4: propPatch

 /**
  * Updates properties for a path
  *
  * This method received a PropPatch object, which contains all the
  * information about the update.
  *
  * Usually you would want to call 'handleRemaining' on this object, to get;
  * a list of all properties that need to be stored.
  *
  * @param string $path
  * @param PropPatch $propPatch
  * @return void
  */
 function propPatch($path, PropPatch $propPatch)
 {
     if (!isset($this->data[$path])) {
         $this->data[$path] = [];
     }
     $propPatch->handleRemaining(function ($properties) use($path) {
         foreach ($properties as $propName => $propValue) {
             if (is_null($propValue)) {
                 unset($this->data[$path][$propName]);
             } else {
                 $this->data[$path][$propName] = $propValue;
             }
             return true;
         }
     });
 }
开发者ID:jakobsack,项目名称:sabre-dav,代码行数:29,代码来源:Mock.php

示例5: propPatch

 /**
  * Updates properties on this node.
  *
  * This method received a PropPatch object, which contains all the
  * information about the update.
  *
  * To update specific properties, call the 'handle' method on this object.
  * Read the PropPatch documentation for more information.
  *
  * @param array $mutations
  * @return bool|array
  */
 public function propPatch(PropPatch $proppatch)
 {
     $proppatch->handleRemaining(function ($updateProperties) {
         switch ($this->failMode) {
             case 'updatepropsfalse':
                 return false;
             case 'updatepropsarray':
                 $r = [];
                 foreach ($updateProperties as $k => $v) {
                     $r[$k] = 402;
                 }
                 return $r;
             case 'updatepropsobj':
                 return new \STDClass();
         }
     });
 }
开发者ID:MetallianFR68,项目名称:myroundcube,代码行数:29,代码来源:PropertiesCollection.php

示例6: updatePrincipal

 /**
  * Updates one ore more webdav properties on a principal.
  *
  * The list of mutations is stored in a Sabre\DAV\PropPatch object.
  * To do the actual updates, you must tell this object which properties
  * you're going to process with the handle() method.
  *
  * Calling the handle method is like telling the PropPatch object "I
  * promise I can handle updating this property".
  *
  * Read the PropPatch documenation for more info and examples.
  *
  * @param string $path
  * @param \Sabre\DAV\PropPatch $propPatch
  */
 public function updatePrincipal($path, \Sabre\DAV\PropPatch $propPatch)
 {
     $value = null;
     foreach ($this->principals as $principalIndex => $value) {
         if ($value['uri'] === $path) {
             $principal = $value;
             break;
         }
     }
     if (!$principal) {
         return;
     }
     $propPatch->handleRemaining(function ($mutations) use($principal, $principalIndex) {
         foreach ($mutations as $prop => $value) {
             if (is_null($value) && isset($principal[$prop])) {
                 unset($principal[$prop]);
             } else {
                 $principal[$prop] = $value;
             }
         }
         $this->principals[$principalIndex] = $principal;
         return true;
     });
 }
开发者ID:mattes,项目名称:sabre-dav,代码行数:39,代码来源:Mock.php

示例7: propPatch

 /**
  * Updates properties for a path
  *
  * @param string $path
  * @param PropPatch $propPatch
  *
  * @return void
  */
 public function propPatch($path, PropPatch $propPatch)
 {
     $node = $this->tree->getNodeForPath($path);
     if (!$node instanceof Node) {
         return;
     }
     $propPatch->handleRemaining(function ($changedProps) use($node) {
         return $this->updateProperties($node, $changedProps);
     });
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:18,代码来源:CustomPropertiesBackend.php

示例8: CONFLICT

    /**
     * Updates properties for a path
     *
     * This method received a PropPatch object, which contains all the
     * information about the update.
     *
     * Usually you would want to call 'handleRemaining' on this object, to get;
     * a list of all properties that need to be stored.
     *
     * @param string $path
     * @param PropPatch $propPatch
     * @return void
     */
    function propPatch($path, PropPatch $propPatch)
    {
        $propPatch->handleRemaining(function ($properties) use($path) {
            if ($this->pdo->getAttribute(\PDO::ATTR_DRIVER_NAME) === 'pgsql') {
                $updateSql = <<<SQL
INSERT INTO {$this->tableName} (path, name, valuetype, value)
VALUES (:path, :name, :valuetype, :value)
ON CONFLICT (path, name)
DO UPDATE SET valuetype = :valuetype, value = :value
SQL;
            } else {
                $updateSql = <<<SQL
REPLACE INTO {$this->tableName} (path, name, valuetype, value)
VALUES (:path, :name, :valuetype, :value)
SQL;
            }
            $updateStmt = $this->pdo->prepare($updateSql);
            $deleteStmt = $this->pdo->prepare("DELETE FROM " . $this->tableName . " WHERE path = ? AND name = ?");
            foreach ($properties as $name => $value) {
                if (!is_null($value)) {
                    if (is_scalar($value)) {
                        $valueType = self::VT_STRING;
                    } elseif ($value instanceof Complex) {
                        $valueType = self::VT_XML;
                        $value = $value->getXml();
                    } else {
                        $valueType = self::VT_OBJECT;
                        $value = serialize($value);
                    }
                    $updateStmt->bindParam('path', $path, \PDO::PARAM_STR);
                    $updateStmt->bindParam('name', $name, \PDO::PARAM_STR);
                    $updateStmt->bindParam('valuetype', $valueType, \PDO::PARAM_INT);
                    $updateStmt->bindParam('value', $value, \PDO::PARAM_LOB);
                    $updateStmt->execute();
                } else {
                    $deleteStmt->execute([$path, $name]);
                }
            }
            return true;
        });
    }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:54,代码来源:PDO.php

示例9: propPatch

 /**
  * Updates properties for a path
  *
  * This method received a PropPatch object, which contains all the
  * information about the update.
  *
  * Usually you would want to call 'handleRemaining' on this object, to get;
  * a list of all properties that need to be stored.
  *
  * @param string $path
  * @param PropPatch $propPatch
  * @return void
  */
 function propPatch($path, PropPatch $propPatch)
 {
     $propPatch->handleRemaining(function ($properties) use($path) {
         $updateStmt = $this->pdo->prepare("REPLACE INTO " . $this->tableName . " (path, name, valuetype, value) VALUES (?, ?, ?, ?)");
         $deleteStmt = $this->pdo->prepare("DELETE FROM " . $this->tableName . " WHERE path = ? AND name = ?");
         foreach ($properties as $name => $value) {
             if (!is_null($value)) {
                 if (is_scalar($value)) {
                     $valueType = self::VT_STRING;
                 } elseif ($value instanceof Complex) {
                     $valueType = self::VT_XML;
                     $value = $value->getXml();
                 } else {
                     $valueType = self::VT_OBJECT;
                     $value = serialize($value);
                 }
                 $updateStmt->execute([$path, $name, $valueType, $value]);
             } else {
                 $deleteStmt->execute([$path, $name]);
             }
         }
         return true;
     });
 }
开发者ID:LETVScloud,项目名称:sabre-dav,代码行数:37,代码来源:PDO.php

示例10: propPatch

 /**
  * Updates properties for a path
  *
  * @param string $path
  * @param PropPatch $propPatch
  *
  * @return void
  */
 public function propPatch($path, PropPatch $propPatch)
 {
     $propPatch->handleRemaining(function ($changedProps) use($path) {
         return $this->updateProperties($path, $changedProps);
     });
 }
开发者ID:kenwi,项目名称:core,代码行数:14,代码来源:custompropertiesbackend.php

示例11: updateSubscription

 /**
  * Updates a subscription
  *
  * The list of mutations is stored in a Sabre\DAV\PropPatch object.
  * To do the actual updates, you must tell this object which properties
  * you're going to process with the handle() method.
  *
  * Calling the handle method is like telling the PropPatch object "I
  * promise I can handle updating this property".
  *
  * Read the PropPatch documenation for more info and examples.
  *
  * @param mixed $subscriptionId
  * @param \Sabre\DAV\PropPatch $propPatch
  * @return void
  */
 function updateSubscription($subscriptionId, DAV\PropPatch $propPatch)
 {
     $found = null;
     foreach ($this->subs[$subscriptionId[0]] as &$sub) {
         if ($sub['id'][1] === $subscriptionId[1]) {
             $found =& $sub;
             break;
         }
     }
     if (!$found) {
         return;
     }
     $propPatch->handleRemaining(function ($mutations) use(&$found) {
         foreach ($mutations as $k => $v) {
             $found[$k] = $v;
         }
         return true;
     });
 }
开发者ID:siite,项目名称:choose-sa-cloud,代码行数:35,代码来源:MockSubscriptionSupport.php

示例12: updateCalendar

 /**
  * Updates properties for a calendar.
  *
  * The list of mutations is stored in a Sabre\DAV\PropPatch object.
  * To do the actual updates, you must tell this object which properties
  * you're going to process with the handle() method.
  *
  * Calling the handle method is like telling the PropPatch object "I
  * promise I can handle updating this property".
  *
  * Read the PropPatch documentation for more info and examples.
  *
  * @param mixed $calendarId
  * @param \Sabre\DAV\PropPatch $propPatch
  * @return void
  */
 function updateCalendar($calendarId, \Sabre\DAV\PropPatch $propPatch)
 {
     $propPatch->handleRemaining(function ($props) use($calendarId) {
         foreach ($this->calendars as $k => $calendar) {
             if ($calendar['id'] === $calendarId) {
                 foreach ($props as $propName => $propValue) {
                     if (is_null($propValue)) {
                         unset($this->calendars[$k][$propName]);
                     } else {
                         $this->calendars[$k][$propName] = $propValue;
                     }
                 }
                 return true;
             }
         }
     });
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:33,代码来源:Mock.php


注:本文中的Sabre\DAV\PropPatch::handleRemaining方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。