Get count from API

@param string $permalink
@return int Count
486234
protected function _get_count( $permalink ) {
		$request  = "https://b.hatena.ne.jp/entry.count?url=$permalink";
		$response = wp_remote_get( $request );
		$body = wp_remote_retrieve_body( $response );

		if ( defined( 'WP_DEBUG' ) && true === WP_DEBUG ) {
			error_log( '[WP Share Buttons] Hatena request / ' . $request . ' / ' . json_encode( $body ) );
		}

		if ( '' === $body ) {
			return 0;
		}

		return $body;
	}
937310
public function getLinksCount($zeroBased = false)
    {
        $count = count($this->getLinks());

        if ($zeroBased) {
            return $count - 1;
        }

        return $count;
    }
1300975
public Integer countPost(Query query) throws ApiException {
        ApiResponse<Integer> resp = countPostWithHttpInfo(query);
        return resp.getData();
    }
1180562
public function count($key)
    {
        if ($this->has($key)) {
            if (\is_array($this->get($key))) {
                return \count($this->get($key));
            }

            return 1;
        }

        return 0;
    }
589314
public function getCount($key)
	{
		$key = strtolower($key);
		
		if(array_key_exists($key, $this->data))
		{
			if(is_array($this->data[$key]))
			{
				return count($this->data[$key]);
			}
			
			return 1;
		}
		
		return 0;
	}
1035320
public function partial_count($section)
	{
		// return the defined partial count
		return array_key_exists($section, $this->partials) ? count($this->partials[$section]) : 0;
	}
1301790
public function countShares($url)
    {
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, self::API_URL);
        curl_setopt($curl, CURLOPT_POST, true);
        curl_setopt($curl, CURLOPT_POSTFIELDS,
            '[{"method":"pos.plusones.get","id":"p",
                "params":{"nolog":true,"id":"'.$url.'","source":"widget","userId":"@viewer","groupId":"@self"},
                "jsonrpc":"2.0","key":"p","apiVersion":"v1"}]'
        );
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
        $curl_results = curl_exec($curl);
        curl_close($curl);
        $data = json_decode($curl_results, true);

        if (isset($data[0]['result']['metadata']['globalCounts']['count'])) {
            return intval($data[0]['result']['metadata']['globalCounts']['count']);
        } else {
            return 0;
        }
    }
396143
public function getReviewAndRatingItemsCount()
    {
        $user = $this->getUser();
        $count = 0;
        if ($user) {
            $count = $this
                ->getContainer()
                ->get(UserReviewAndRatingBridgeInterface::class)
                ->getReviewAndRatingListCount($user->getId());
        }

        return $count;
    }
1101069
public function count() {
    if (isset($this->_href)) {
      $headers = Recurly_Base::_head($this->_href, $this->_client);
      if (isset($headers['x-records'])) {
        return intval($headers['x-records']);
      }
    } elseif (isset($this->_objects) && is_array($this->_objects)) {
      return count($this->_objects);
    }

    return null;
  }
1051522
function(permalink) {
    permalink = permalink || '';
    if (permalink.slice(0, 1) !== PATH_SEP) {
      permalink = PATH_SEP + permalink;
    }
    permalink = permalink.replace(INDEX_RE, PATH_SEP);
    return permalink;
  }
415923
public function GetCount($Wheres = '', $ForceNoAnnouncements = FALSE) {
      if (is_array($Wheres) && count($Wheres) == 0)
         $Wheres = '';
      
      // Check permission and limit to categories as necessary
      if ($this->Watching)
         $Perms = CategoryModel::CategoryWatch();
      else
         $Perms = self::CategoryPermissions();
      
      if (!$Wheres || (count($Wheres) == 1 && isset($Wheres['d.CategoryID']))) {
         // Grab the counts from the faster category cache.
         if (isset($Wheres['d.CategoryID'])) {
            $CategoryIDs = (array)$Wheres['d.CategoryID'];
            if ($Perms === FALSE)
               $CategoryIDs = array();
            elseif (is_array($Perms))
               $CategoryIDs = array_intersect($CategoryIDs, $Perms);
            
            if (count($CategoryIDs) == 0) {
               return 0;
            } else {
               $Perms = $CategoryIDs;
            }
         }
         
         $Categories = CategoryModel::Categories();
         $Count = 0;
         
         foreach ($Categories as $Cat) {
            if (is_array($Perms) && !in_array($Cat['CategoryID'], $Perms))
               continue;
            $Count += (int)$Cat['CountDiscussions'];
         }
         return $Count;
      }
      
      if ($Perms !== TRUE) {
         $this->SQL->WhereIn('c.CategoryID', $Perms);
      }
      
      $this->EventArguments['Wheres'] = &$Wheres;
		$this->FireEvent('BeforeGetCount'); // @see 'BeforeGet' for consistency in count vs. results
         
      $this->SQL
         ->Select('d.DiscussionID', 'count', 'CountDiscussions')
         ->From('Discussion d')
         ->Join('Category c', 'd.CategoryID = c.CategoryID')
         ->Join('UserDiscussion w', 'd.DiscussionID = w.DiscussionID and w.UserID = '.Gdn::Session()->UserID, 'left')
         ->Where($Wheres);
      
      $Result = $this->SQL
         ->Get()
         ->FirstRow()
         ->CountDiscussions;
      
      return $Result;
   }
652699
protected function _actionGetcount(AnCommandContext $context)
    {
        $count = $this->actor->numOfNewNotifications();
        return $this->getView()->newNotifications($count)->display();
    }
1014195
public static function count ($status = FALSE)
	{
		
		// If no status return all messages
		
		if ($status === FALSE)
		{
			return count (self::$messages);
		}
		
		// Return messages for a specific status
		
		if (isset (self::$messages[$status]))
		{
			return count (self::$messages[$status]);
		}
		else
		{
			return 0;
		}
		
	}
1250975
public function getDirLevel()
	{
		if (!trim($this->getPath()))
		{
			return 0;
		}

		$dirParts = explode('/', $this->getPath());

		return count($dirParts);
	}
109803
function get_call_count($tag='') {
		if ($tag) {
			$count = 0;
			foreach ($this->events as $e)
				if ($e['action'] == $tag)
					++$count;
			return $count;
		}
		return count($this->events);
	}
1327153
public function countShares($url)
    {
        $api_url = sprintf(self::API_URL, urlencode($url));
        $data = null;
        try {
            $data = json_decode(file_get_contents($api_url), true);
        } catch (\Exception $e) {
            $data = null;
        }

        return ($data !== null && isset($data[0]->share_count)) ? intval($data[0]->share_count) : 0;
    }
35355
public function my_getSubMembersCount($topic)
    {
        $count = $this->th_getSubMembersCount($topic);
        foreach ($this->client as $client) {
            $token = $client->getSubMembersCount($topic);
            $one_count = $client->getTokenResult($token);
            $count += $one_count;
        }
        return $count;
    }