@since 1.0

{@inheritDoc}
774694
public function delete( $id ) {

		if ( $this->contains( $id ) ) {
			$this->count--;
			$this->cacheDeletes++;
			unset( $this->cache[ $id ] );
			unset( $this->ttl[ $id ] );
			return true;
		}

		return false;
	}
579783
function (since, callback) {
      if (opts.aborted) {
        return;
      }
      params.since = since;
      // "since" can be any kind of json object in Coudant/CouchDB 2.x
      /* istanbul ignore next */
      if (typeof params.since === "object") {
        params.since = JSON.stringify(params.since);
      }

      if (opts.descending) {
        if (limit) {
          params.limit = leftToFetch;
        }
      } else {
        params.limit = (!limit || leftToFetch > batchSize) ?
          batchSize : leftToFetch;
      }

      // Set the options for the ajax call
      var xhrOpts = {
        method: method,
        url: genDBUrl(host, '_changes' + paramsToStr(params)),
        timeout: opts.timeout,
        body: body
      };
      lastFetchedSeq = since;

      /* istanbul ignore if */
      if (opts.aborted) {
        return;
      }

      // Get the changes
      setup().then(function () {
        xhr = ajax(opts, xhrOpts, callback);
      }).catch(callback);
    }
1318578
public function find($id = NULL)
    {
        if ($id !== NULL)
        {
            $data             = $this->getData();
            $this->currentId  = $id;
            $this->currentKey = $this->getRowKey($id);
            foreach ($data[$this->currentKey] as $field => $value)
            {
                $this->setField($field, $value);
            }
        }
        else
        {
            $this->limit(1)->findAll();
            $data = $this->data;
            if (count($data))
            {
                foreach ($data[0] as $field => $value)
                {
                    $this->setField($field, $value);
                }

                $this->currentId  = $this->getField('id');
                $this->currentKey = $this->getRowKey($this->currentId);
            }
        }
        return clone $this;
    }
18177
public function commit() {
        $this->connect();
        if (1 == $this->transTimes) {
            $this->pdo->commit();
        }
        --$this->transTimes;
    }
394408
public function globalFeed($filter = array(), $orderBy = 'ID DESC', $since = null, $number = 10, $markViewed = true) {
		$number = (int) $number;
		
		if (!count($filter)) {
			$filter = array('ParentID' => 0);
		}
		$filter['Deleted'] = 0;

		$items = MicroPost::get()->filter($filter)->sort($orderBy);
		
		if ($since) {
			$since = (int) $since;
			$items = $items->filter('ID:GreaterThan', $since);
		}

		if ($markViewed) {
			$this->recordUserAction();
		}
		$items = $this->updatePostList($items);
		return $items->limit($number)->restrict();
	}
496443
public function setActiveContext($context)
    {
        $oldLocale = isset($this->activeContext) ? $this->contextLocales[$this->activeContext] : null;
        $this->activeContext = $context;
        if (!isset($this->contextLocales[$context])) {
            $this->setContextLocale($context, static::BASE_LOCALE);
        }
        $newLocale = $this->contextLocales[$context];
        if ($newLocale !== $oldLocale) {
            $this->currentLocaleChanged($newLocale);
        }
    }
1236402
public function getList($since = 0)
	{
		// Build the request path.
		$uri = new Uri($this->fetchUrl('/users'));

		if ($since)
		{
			$uri->setVar('since', $since);
		}

		// Send the request.
		return $this->processResponse($this->client->get($uri));
	}
462530
public function map($json,&$resultObject)
    {
        if ($this->RootElement && property_exists($json, $this->RootElement)) {
            $json = $json->{$this->RootElement};
            $this->RootElement = null;
        }

        if ($resultObject instanceof IEntityType) {
            if ($resultObject instanceof IEntityTypeCollection)
                $this->mapTypeCollection($json, $resultObject);
            else
                $this->mapType($json, $resultObject);
        }
        else
            $resultObject = $json;

    }
1240592
public function current()
    {
        $k = key($this->ids);
        if (null === $k) {
            return false;
        }

        if (count($this->ids) == 1) {
            return $this;
        }

        if (!isset($this->_ich[$k])) {
            $this->_ich[$k] = new self($this->doc, array($k => $this->ids[$k]));
        }

        return $this->_ich[$k];
    }
420324
function todoWriter(&$doclet) {

        parent::MDWriter($doclet);

        $rootDoc = & $this->_doclet->rootDoc();

        $todoClasses = array();
        $classes = & $rootDoc->classes();
        $todoFields = array();
        $todoMethods = array();
        if ($classes) {
            foreach ($classes as $class) {
                if ($class->tags("@todo")) {
                    $todoClasses[] = $class;
                }
                $fields = & $class->fields();
                if ($fields) {
                    foreach ($fields as $field) {
                        if ($field->tags("@todo")) {
                            $todoFields[] = $field;
                        }
                    }
                }
                $classes = & $class->methods();
                if ($classes) {
                    foreach ($classes as $method) {
                        if ($method->tags("@todo")) {
                            $todoMethods[] = $method;
                        }
                    }
                }
            }
        }
        $todoGlobals = array();
        $globals = & $rootDoc->globals();
        if ($globals) {
            foreach ($globals as $global) {
                if ($global->tags("@todo")) {
                    $todoGlobals[] = $global;
                }
            }
        }
        $todoFunctions = array();
        $functions = & $rootDoc->functions();
        if ($functions) {
            foreach ($functions as $function) {
                if ($function->tags("@todo")) {
                    $todoFunctions[] = $function;
                }
            }
        }

        ob_start();

        echo "- - -\n\n";

        echo "#Todo#";

        echo "\n\n- - -\n\n";

        if ($todoClasses || $todoFields || $todoMethods || $todoGlobals || $todoFunctions) {
            echo "##Contents##\n\n";

            echo "<ul>\n";
            if ($todoClasses) {
                echo "<li><a href=\"#todo_class\">Todo Classes</a></li>";
            }
            if ($todoFields) {
                echo "<li><a href=\"#todo_field\">Todo Fields</a></li>";
            }
            if ($todoMethods) {
                echo "<li><a href=\"#todo_method\">Todo Methods</a></li>";
            }
            if ($todoGlobals) {
                echo "<li><a href=\"#todo_global\">Todo Globals</a></li>";
            }
            if ($todoFunctions) {
                echo "<li><a href=\"#todo_function\">Todo Functions</a></li>";
            }
            echo "</ul>\n";
        }

        if ($todoClasses) {
            echo "<table id=\"todo_class\" class=\"detail\">", "\n";
            echo "<tr><th colspan=\"2\" class=\"title\">Todo Classes</th></tr>", "\n";
            foreach ($todoClasses as $class) {
                $todoTag = & $class->tags("@todo");
                echo "<tr><td class=\"name\"><a href=\"", $this->_asURL($class), "\">", $class->qualifiedName(), "</a></td>";
                echo "<td class=\"description\">";
                if ($todoTag)
                    echo strip_tags($this->_processInlineTags($todoTag, TRUE), "<a><b>**<u><em>");
                echo "</td></tr>\n";
            }
            echo "</table>\n\n";
        }

        if ($todoFields) {
            echo "<table id=\"todo_field\" class=\"detail\">", "\n";
            echo "<tr><th colspan=\"2\" class=\"title\">Todo Fields</th></tr>", "\n";
            foreach ($todoFields as $field) {
                $todoTag = & $field->tags("@todo");
                echo "<tr>\n";
                echo "<td class=\"name\"><a href=\"", $this->_asURL($field), "\">", $field->qualifiedName(), "</a></td>\n";
                echo "<td class=\"description\">";
                if ($todoTag)
                    echo strip_tags($this->_processInlineTags($todoTag, TRUE), "<a><b>**<u><em>");
                echo "</td>\n";
                echo "</tr>\n";
            }
            echo "</table>\n\n";
        }

        if ($todoMethods) {
            echo "<table id=\"todo_method\" class=\"detail\">", "\n";
            echo "<tr><th colspan=\"2\" class=\"title\">Todo Methods</th></tr>", "\n";
            foreach ($todoMethods as $method) {
                $todoTag = & $method->tags("@todo");
                echo "<tr>\n";
                echo "<td class=\"name\"><a href=\"", $this->_asURL($method), "\">", $method->qualifiedName(), "</a></td>\n";
                echo "<td class=\"description\">";
                if ($todoTag)
                    echo strip_tags($this->_processInlineTags($todoTag, TRUE), "<a><b>**<u><em>");
                echo "</td>\n";
                echo "</tr>\n";
            }
            echo "</table>\n\n";
        }

        if ($todoGlobals) {
            echo "<table id=\"todo_global\" class=\"detail\">", "\n";
            echo "<tr><th colspan=\"2\" class=\"title\">Todo Globals</th></tr>", "\n";
            foreach ($todoGlobals as $global) {
                $todoTag = & $global->tags("@todo");
                echo "<tr>\n";
                echo "<td class=\"name\"><a href=\"", $this->_asURL($global), "\">", $global->qualifiedName(), "</a></td>\n";
                echo "<td class=\"description\">";
                if ($todoTag)
                    echo strip_tags($this->_processInlineTags($todoTag, TRUE), "<a><b>**<u><em>");
                echo "</td>\n";
                echo "</tr>\n";
            }
            echo "</table>\n\n";
        }

        if ($todoFunctions) {
            echo "<table id=\"todo_function\" class=\"detail\">", "\n";
            echo "<tr><th colspan=\"2\" class=\"title\">Todo Functions</th></tr>", "\n";
            foreach ($todoFunctions as $function) {
                $todoTag = & $function->tags("@todo");
                echo "<tr>\n";
                echo "<td class=\"name\"><a href=\"", $this->_asURL($function), "\">", $function->qualifiedName(), "</a></td>\n";
                echo "<td class=\"description\">";
                if ($todoTag)
                    echo strip_tags($this->_processInlineTags($todoTag, TRUE), "<a><b>**<u><em>");
                echo "</td>\n";
                echo "</tr>\n";
            }
            echo "</table>\n\n";
        }

        $this->_output = ob_get_contents();
        ob_end_clean();

        $this->_write("todo-list.md");
    }
970680
public function init()
    {
        if ($this->countRows < 1) {
            $this->totalPages = 0;
            $this->currentPage = 0;

            return;
        }

        if ($this->limit < 10) {
            $this->limit = 10;
        }

        $this->totalPages = (int)($this->countRows / $this->limit);

        if ($this->countRows % $this->limit) {
            $this->totalPages++;
        }

        if ($this->totalPages === 0) {
            $this->totalPages = 1;
        }

        if ($this->currentPage < 0) {
            $this->currentPage = 0;
        }

        if ($this->currentPage > $this->totalPages) {
            $this->currentPage = $this->totalPages;
        }
    }
948449
function indexWriter(&$doclet) {

        parent::MDWriter($doclet);

        $phpdoctor = & $this->_doclet->phpdoctor();
        $displayTree = $phpdoctor->getOption("tree");

        $rootDoc = & $this->_doclet->rootDoc();

        $classes = & $rootDoc->classes();
        if ($classes == NULL)
            $classes = array();

        $functions = & $rootDoc->functions();
        if ($functions == NULL)
            $functions = array();

        $globals = & $rootDoc->globals();
        if ($globals == NULL)
            $globals = array();

        $elements = array_merge($classes, $functions, $globals);
        uasort($elements, array($this, "compareElements"));

        ob_start();

        echo "#INDEX#";

        if(isset($this->_doclet->phpdoctor()->_options["github_sources_repository"])){
            echo "\n\n[View Source codes]({$this->getSourcesBaseURL()})";
        }
        
        if ($displayTree) {
            echo "\n\n[View class hierarchy]({$this->getDirBaseURL()}/overview-tree.md)";
        }
        
        echo "\n\n[View depreacted list]({$this->getDirBaseURL()}/deprecated-list.md)";

        echo "\n\n[View todo list]({$this->getDirBaseURL()}/todo-list.md)";

        echo "\n\n[View the list of all classes, functions and globals]({$this->getDirBaseURL()}/index-all.md)";

        $this->_output = ob_get_contents();
        ob_end_clean();

        $this->_write("README.md");

        ///------------------------------------------------------

        ob_start();

        $letter = 64;
        foreach ($elements as $name => $element) {
            $firstChar = strtoupper(substr($element->name(), 0, 1));
            if (is_object($element) && $firstChar != chr($letter)) {
                $letter = ord($firstChar);
                echo "<a href=\"#", strtolower(chr($letter)), "\">", chr($letter), "</a>\n";
            }
        }

        echo "- - -\n\n";

        $first = TRUE;
        foreach ($elements as $element) {
            if (is_object($element)) {
                if (strtoupper(substr($element->name(), 0, 1)) != chr($letter)) {
                    $letter = ord(strtoupper(substr($element->name(), 0, 1)));
                    if (!$first) {
                        echo "</dl>\n";
                    }
                    $first = FALSE;
                    echo "<h1 id=\"letter", chr($letter), "\">", chr($letter), "</h1>\n";
                    echo "<dl>\n";
                }
                $parent = & $element->containingClass();
                if ($parent && strtolower(get_class($parent)) != "rootdoc") {
                    $in = "class <a href=\"" . $this->_asURL($parent) . "\">" . $parent->qualifiedName() . "</a>";
                } else {
                    $package = & $element->containingPackage();
                    $in = "namespace <a href=\"" . $this->_asURL($package) . "/README.md\">" . $package->name() . "</a>";
                }
                switch (strtolower(get_class($element))) {
                    case "classdoc":
                        if ($element->isOrdinaryClass()) {
                            echo "<dt><a href=\"", $this->_asURL($element), "\">", $element->name(), "</a> - Class in ", $in, "</dt>\n";
                        } elseif ($element->isInterface()) {
                            echo "<dt><a href=\"", $this->_asURL($element), "\">", $element->name(), "</a> - Interface in ", $in, "</dt>\n";
                        } elseif ($element->isException()) {
                            echo "<dt><a href=\"", $this->_asURL($element), "\">", $element->name(), "</a> - Exception in ", $in, "</dt>\n";
                        }
                        break;
                    case 'methoddoc':
                        if ($element->isFunction()) {
                            echo '<dt><a href="', $this->_asURL($element), '">', $element->name(), '()</a> - Function in ', $in, "</dt>\n";
                        }
                        break;
                    case "fielddoc":
                        if ($element->isGlobal()) {
                            echo "<dt><a href=\"", $this->_asURL($element), "\">", $element->name(), "</a> - Global in ", $in, "</dt>\n";
                        }
                        break;
                }
                if ($textTag = & $element->tags("@text") && $firstSentenceTags = & $textTag->firstSentenceTags($this->_doclet)) {
                    echo "<dd>";
                    foreach ($firstSentenceTags as $firstSentenceTag) {
                        echo $firstSentenceTag->text($this->_doclet);
                    }
                    echo "</dd>\n";
                }
            }
        }
        echo "</dl>\n";

        $this->_output = ob_get_contents();
        ob_end_clean();

        $this->_write("index-all.md");
    }
69827
public function select($field)
    {
        $fields = (is_array($field) ? $field : func_get_args());

        foreach ((array) $fields as $field) {
            $this->fields[$field] = 1;
        }
    }
996508
public function from($from = null) {
        if ($from === null) {
            return $this->from;
        }

        $this->from = (int) $from;

        return $this;
    }
239596
protected function _resolve()
    {
        if (!$this->_deferred) {
            return;
        }
        $data = $this->_deferred;

        $instance = $data['instance'];
        $this->_not = $data['not'];
        $boolean = $instance->resolve();
        $data['description'] = $instance->description();
        $data['backtrace'] = $instance->backtrace();
        $this->_log($boolean, $data);

        $this->_deferred = null;
    }
1223148
public function handleVersionAnnotation($e)
    {
        $annotation = $e->getParam('annotation');
        if (!$annotation instanceof Annotation\Version) {
            return;
        }
    
        $serviceSpec = $e->getParam('serviceSpec');
        $serviceSpec['version'] = $annotation->getVersion();
    }
552347
public function perform()
    {
        /** @var DocumentDeclaration $declaration */
        $declaration = $this->createDeclaration();

        foreach ($this->option('field') as $field) {
            if (strpos($field, ':') === false) {
                throw new ScaffolderException("Field definition must in 'name:type' form");
            }

            list($name, $type) = explode(':', $field);
            $declaration->addField($name, $type);
        }

        $declaration->setCollection((string)$this->option('collection'));
        $declaration->setDatabase((string)$this->option('database'));

        $this->writeDeclaration($declaration->normalizeDeclaration());

        if ($this->option('source')) {
            $this->writeDeclaration(
                $this->sourceDeclaration(
                    $this->argument('name'),
                    'document',
                    $this->getNamespace() . '\\' . $this->getClass()
                ),
                'source'
            );
        }
    }